Home All Groups Group Topic Archive Search About
Author
3 May 2007 9:23 AM
5070707
Hi all!

I have a small form build with visual studio 2005 (Visual Basic)
in that form i have some text boxes and some combos.
these are being field by the users followed by an mail submit button i
created using a snipet.

the button code:

Private Sub butmail_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butmail.Click
        Dim body As String = Me.DateTimePicker1.Text()
        Dim message As New MailMessage("***@aaa.com", "a**@aaa.com",
"Computer Notice", body)
        Dim emailClient As New SmtpClient("aaa.aaa.aaa")
        emailClient.Send(message)

    End Sub
End Class

Now, the email does arrive containing the data that the user typed in
the fields,
but the data comes as a stright string with no spaces in the msg body.

im looking to understand how can i design the way the msg arrived at
the email box.
lets say for example..

name: the data
owner: the data
last upgrade: data
etc...

bare in mind that it took me ages to perform this small form :) i have
no idea in programing what so ever, just following the logic...
so code samples would be greatly appriciated!

thanks for everything!

50.

Author
3 May 2007 10:39 AM
rowe_newsgroups
On May 3, 5:23 am, 5070***@gmail.com wrote:
Show quoteHide quote
> Hi all!
>
> I have a small form build with visual studio 2005 (Visual Basic)
> in that form i have some text boxes and some combos.
> these are being field by the users followed by an mail submit button i
> created using a snipet.
>
> the button code:
>
> Private Sub butmail_Click_1(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles butmail.Click
>         Dim body As String = Me.DateTimePicker1.Text()
>         Dim message As New MailMessage("a***@aaa.com", "a***@aaa.com",
> "Computer Notice", body)
>         Dim emailClient As New SmtpClient("aaa.aaa.aaa")
>         emailClient.Send(message)
>
>     End Sub
> End Class
>
> Now, the email does arrive containing the data that the user typed in
> the fields,
> but the data comes as a stright string with no spaces in the msg body.
>
> im looking to understand how can i design the way the msg arrived at
> the email box.
> lets say for example..
>
> name: the data
> owner: the data
> last upgrade: data
> etc...
>
> bare in mind that it took me ages to perform this small form :) i have
> no idea in programing what so ever, just following the logic...
> so code samples would be greatly appriciated!
>
> thanks for everything!
>
> 50.

How about:

' Typed in message
Private Sub butmail_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butmail.Click
         Dim body As String = String.Format("<b>Name: </b>{0}<br />",
Me.NameTextBox.Text)
         body &= String.Format("<b>Owner: </b>{0} <br />",
Me.OwnerTextBox.Text)
         body &= String.Format("<b>Last Upgrade: </b>{0} <br />",
Me.LastUpgradeTextBox.Text)
         ' etc
         Dim message As New MailMessage("a***@aaa.com",
"a***@aaa.com",
"Computer Notice", body)
         message.IsBodyHtml = True
         Dim emailClient As New SmtpClient("aaa.aaa.aaa")
         emailClient.Send(message)
     End Sub
End Class

Thanks,

Seth Rowe
Author
3 May 2007 10:59 AM
5070707
On May 3, 12:39 pm, rowe_newsgroups <rowe_em***@yahoo.com> wrote:
Show quoteHide quote
> On May 3, 5:23 am, 5070***@gmail.com wrote:
>
>
>
>
>
> > Hi all!
>
> > I have a small form build with visual studio 2005 (Visual Basic)
> > in that form i have some text boxes and some combos.
> > these are being field by the users followed by an mail submit button i
> > created using a snipet.
>
> > the button code:
>
> > Private Sub butmail_Click_1(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles butmail.Click
> >         Dim body As String = Me.DateTimePicker1.Text()
> >         Dim message As New MailMessage("a***@aaa.com", "a***@aaa.com",
> > "Computer Notice", body)
> >         Dim emailClient As New SmtpClient("aaa.aaa.aaa")
> >         emailClient.Send(message)
>
> >     End Sub
> > End Class
>
> > Now, the email does arrive containing the data that the user typed in
> > the fields,
> > but the data comes as a stright string with no spaces in the msg body.
>
> > im looking to understand how can i design the way the msg arrived at
> > the email box.
> > lets say for example..
>
> > name: the data
> > owner: the data
> > last upgrade: data
> > etc...
>
> > bare in mind that it took me ages to perform this small form :) i have
> > no idea in programing what so ever, just following the logic...
> > so code samples would be greatly appriciated!
>
> > thanks for everything!
>
> > 50.
>
> How about:
>
> ' Typed in message
>  Private Sub butmail_Click_1(ByVal sender As System.Object, ByVal e As
>  System.EventArgs) Handles butmail.Click
>          Dim body As String = String.Format("<b>Name: </b>{0}<br />",
> Me.NameTextBox.Text)
>          body &= String.Format("<b>Owner: </b>{0} <br />",
> Me.OwnerTextBox.Text)
>          body &= String.Format("<b>Last Upgrade: </b>{0} <br />",
> Me.LastUpgradeTextBox.Text)
>          ' etc
>          Dim message As New MailMessage("a***@aaa.com",
> "a***@aaa.com",
>  "Computer Notice", body)
>          message.IsBodyHtml = True
>          Dim emailClient As New SmtpClient("aaa.aaa.aaa")
>          emailClient.Send(message)
>      End Sub
>  End Class
>
> Thanks,
>
> Seth Rowe- Hide quoted text -
>
> - Show quoted text -

Seth!!! Thank you so much!!!
Works great!!!

could i bother you with one lastttttt question?!

how can i popup a dialog box after the user pressed the button "Email
Sent!" and clear the form for next data?

50.
Author
3 May 2007 11:11 AM
rowe_newsgroups
> could i bother you with one lastttttt question?!
>
> how can i popup a dialog box after the user pressed the button "Email
> Sent!" and clear the form for next data?

Hey that's two questions! :-)

        If MessageBox.Show("Do you want to clear the form?", "Clear
Form?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
Windows.Forms.DialogResult.Yes Then
            ' There are other ways to clear the text properties
            ' of every control on the form than clearing them
            ' individually, but since you are just starting you
            ' might want to stick with this simple approach
            Me.TextBox1.Text = ""
            Me.TextBox2.Text = ""
            Me.TextBox3.Text = ""
            ' etc
        End If

Thanks,

Seth Rowe
Author
3 May 2007 11:17 AM
5070707
On May 3, 1:11 pm, rowe_newsgroups <rowe_em***@yahoo.com> wrote:
Show quoteHide quote
> > could i bother you with one lastttttt question?!
>
> > how can i popup a dialog box after the user pressed the button "Email
> > Sent!" and clear the form for next data?
>
> Hey that's two questions! :-)
>
>         If MessageBox.Show("Do you want to clear the form?", "Clear
> Form?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
> Windows.Forms.DialogResult.Yes Then
>             ' There are other ways to clear the text properties
>             ' of every control on the form than clearing them
>             ' individually, but since you are just starting you
>             ' might want to stick with this simple approach
>             Me.TextBox1.Text = ""
>             Me.TextBox2.Text = ""
>             Me.TextBox3.Text = ""
>             ' etc
>         End If
>
> Thanks,
>
> Seth Rowe


"Hey that's two questions! :-)" -> why stick to semantics ? :)

should i just paste this under the button code?
Author
3 May 2007 11:23 AM
5070707
On May 3, 1:11 pm, rowe_newsgroups <rowe_em***@yahoo.com> wrote:
Show quoteHide quote
> > could i bother you with one lastttttt question?!
>
> > how can i popup a dialog box after the user pressed the button "Email
> > Sent!" and clear the form for next data?
>
> Hey that's two questions! :-)
>
>         If MessageBox.Show("Do you want to clear the form?", "Clear
> Form?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
> Windows.Forms.DialogResult.Yes Then
>             ' There are other ways to clear the text properties
>             ' of every control on the form than clearing them
>             ' individually, but since you are just starting you
>             ' might want to stick with this simple approach
>             Me.TextBox1.Text = ""
>             Me.TextBox2.Text = ""
>             Me.TextBox3.Text = ""
>             ' etc
>         End If
>
> Thanks,
>
> Seth Rowe

Works like a charm!
so much thanks seth!!

50.