Support Forums

Full Version: VB 2008 - Useful Code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
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 line
Code:
If My.Computer.FileSystem.FileExists(attachedFile) Then message.Attachments.Add(attach)
If 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 at
Code:
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 advance
very nice sources
That first one is sweet, nice guide.
(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 line
Code:
If My.Computer.FileSystem.FileExists(attachedFile) Then message.Attachments.Add(attach)
If 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 at
Code:
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 advance

What happens when you run the program? Unless you forgot to add,
Code:
Dim attach As System.Net.Mail.Attachment
Then I think it should work fine..
Thanks for the code :p

(05-13-2010, 01:37 AM)Dubstep Wrote: [ -> ]What happens when you run the program? Unless you forgot to add,
Code:
Dim attach As System.Net.Mail.Attachment
Then I think it should work fine..

This should work, good luck.
Very useful for beginners, thanks for the share.
This will come in handy for sure.
This is a nice list of codes. Thanks.
Thanks for the code dude I will test it.
Thanks man. I'm learning VB.Net and this was pretty cool Smile
Nicely Done.. Good Job
Pages: 1 2 3 4