I am a beginner and I am using VB.NET 2005
I want to email an attachment and I have written some code but I am
getting an error.
Dim emailAttachment As Attachment = New
Attachment(List Box1.Items.ToSt ring)
Dim emailClient As New SmtpClient(SMTP .TextBox1.Text)
Try
Mail.Attachment s.Add(emailAtta chment)
emailClient.Sen d(Mail)
Catch ex As Exception
MsgBox(ex.Messa ge)
Finally
Mail = Nothing
emailClient = Nothing
emailAttachment = Nothing
I also have some code to open a dialogue and select a file.
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
OpenFileDialog1 .ShowDialog()
End Sub
Private Sub OpenFileDialog1 _FileOk(ByVal sender As System.Object,
ByVal e As System.Componen tModel.CancelEv entArgs) Handles
OpenFileDialog1 .FileOk
ListBox1.Items. Add(OpenFileDia log1.FileName)
End Sub
Please help!!!!!!!!!!
I want to email an attachment and I have written some code but I am
getting an error.
Dim emailAttachment As Attachment = New
Attachment(List Box1.Items.ToSt ring)
Dim emailClient As New SmtpClient(SMTP .TextBox1.Text)
Try
Mail.Attachment s.Add(emailAtta chment)
emailClient.Sen d(Mail)
Catch ex As Exception
MsgBox(ex.Messa ge)
Finally
Mail = Nothing
emailClient = Nothing
emailAttachment = Nothing
I also have some code to open a dialogue and select a file.
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
OpenFileDialog1 .ShowDialog()
End Sub
Private Sub OpenFileDialog1 _FileOk(ByVal sender As System.Object,
ByVal e As System.Componen tModel.CancelEv entArgs) Handles
OpenFileDialog1 .FileOk
ListBox1.Items. Add(OpenFileDia log1.FileName)
End Sub
Please help!!!!!!!!!!