05-13-2010, 01:37 AM
(05-01-2010, 07:45 AM)macas5 Wrote: Hello, I'm new at programming with VB .net. When i tried to make an emailer plus file attacher i am getting errors at this lineIf i am making with path textbox and if i dont write textbox name in "attachedFile" slot i get error cause it's not defined, BUT if i write correct name i get an error atCode:If My.Computer.FileSystem.FileExists(attachedFile) Then message.Attachments.Add(attach)
It says "Variable 'attach' is used before it has been assigned value. A null reference could result exception at a runtime." any help? Thank you in advanceCode:message.Attachments.Add(attach)
What happens when you run the program? Unless you forgot to add,
Code:
Dim attach As System.Net.Mail.Attachment