开发者

how to attach a file in vb.net email sending program?

开发者 https://www.devze.com 2022-12-15 07:32 出处:网络
I\'m making a windows form. Here is my current code: I don\'t have any idea on how to link the open file dialog with the file that I am going to attach.

I'm making a windows form. Here is my current code: I don't have any idea on how to link the open file dialog with the file that I am going to attach.

    Try
        With OpenFileDialog1

            'OpenFileDialog1
            .Filter开发者_如何学Python = "Text files (*.txt)|*.txt|" & "All files|*.*"

            If .ShowDialog() = DialogResult.OK Then

            End If
        End With
    Catch
        MsgBox("error occured!")


Something similar to..

Dim attach As MailAttachment = New MailAttachment(openFileDialog1.FileName) 


Email.Attachments.Add(attach)
0

精彩评论

暂无评论...
验证码 换一张
取 消