Support Forums
VB 2008 - Useful Code - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: VB 2008 - Useful Code (/showthread.php?tid=3199)

Pages: 1 2 3 4


RE: VB 2008 - Useful Code - macas5 - 05-01-2010

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


RE: VB 2008 - Useful Code - NathanE - 05-01-2010

very nice sources


RE: VB 2008 - Useful Code - Nemmyy - 05-12-2010

That first one is sweet, nice guide.


RE: VB 2008 - Useful Code - Fragma - 05-13-2010

(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..


RE: VB 2008 - Useful Code - Julie - 05-13-2010

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.


RE: VB 2008 - Useful Code - //Pretext™ - 05-18-2010

Very useful for beginners, thanks for the share.
This will come in handy for sure.


RE: VB 2008 - Useful Code - Marik™ - 05-24-2010

This is a nice list of codes. Thanks.


RE: VB 2008 - Useful Code - Marik™ - 05-24-2010

Thanks for the code dude I will test it.


RE: VB 2008 - Useful Code - eXosphere™ - 05-24-2010

Thanks man. I'm learning VB.Net and this was pretty cool Smile


RE: VB 2008 - Useful Code - Vipermakd - 05-26-2010

Nicely Done.. Good Job