Click here to Skip to main content
15,911,896 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Form Load and Re-load - Slow Pin
nlarson1119-Jun-08 10:37
nlarson1119-Jun-08 10:37 
Questionaccessing database from window service Pin
Ebube19-Jun-08 5:59
Ebube19-Jun-08 5:59 
AnswerRe: accessing database from window service Pin
Ashfield19-Jun-08 6:22
Ashfield19-Jun-08 6:22 
GeneralRe: accessing database from window service Pin
Ebube20-Jun-08 22:26
Ebube20-Jun-08 22:26 
GeneralRe: accessing database from window service Pin
Ashfield21-Jun-08 7:48
Ashfield21-Jun-08 7:48 
QuestionFirst Call to Remote Object Does Not Respond on Two Machines Pin
TheFarsider19-Jun-08 5:28
TheFarsider19-Jun-08 5:28 
AnswerRe: First Call to Remote Object Does Not Respond on Two Machines Pin
BDEz (Member 3919223)19-Jun-08 7:28
BDEz (Member 3919223)19-Jun-08 7:28 
QuestionReferenced class won't let go of file [modified] Pin
KreativeKai19-Jun-08 3:24
professionalKreativeKai19-Jun-08 3:24 
I have a class setup that sends an e-mail using SMTP. This class is setup to be used by other programs using it as a reference.

I have a program that creates a file and then calls this class to send the e-mail with the attachment. After the class sends the file and returns a boolean of True to tell the calling program it succeeded, the original program is supposed to delete the original file.

Unfortunately the calling program seems to still be holding onto the file. Below is snippits of the code from the e-mail class. How can I get this class to let go of any attachments that it works with? Everything is working fine, it sends the e-mail, etc, but won't let go.

...
Dim myAttachment As System.Net.Mail.Attachment = New System.Net.Mail.Attachment("c:\test.txt")
Message.Attachments.Add(myAttachment)
...
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "SMTP.Mydomain.com"
SmtpMail.Credentials = New System.Net.NetworkCredential("myUsername", "myPassword")
SmtpMail.Send(Message)
Return True

I have a try catch that will send false if the e-mail fails.

I tried this code but it didn't seem to help:

SmtpMail = Nothing
Message = Nothing

Any help / suggestions are appreciated. Confused | :confused:

Lost in the vast sea of .NET

modified on Thursday, June 19, 2008 9:44 AM

AnswerRe: Referenced class won't let go of file Pin
Colin Angus Mackay19-Jun-08 4:05
Colin Angus Mackay19-Jun-08 4:05 
GeneralRe: Referenced class won't let go of file Pin
KreativeKai19-Jun-08 4:17
professionalKreativeKai19-Jun-08 4:17 
GeneralRe: Referenced class won't let go of file Pin
Colin Angus Mackay19-Jun-08 5:39
Colin Angus Mackay19-Jun-08 5:39 
GeneralRe: Referenced class won't let go of file Pin
KreativeKai20-Jun-08 4:05
professionalKreativeKai20-Jun-08 4:05 
AnswerRe: Referenced class won't let go of file Pin
TheFarsider19-Jun-08 5:39
TheFarsider19-Jun-08 5:39 
GeneralRe: Referenced class won't let go of file Pin
KreativeKai20-Jun-08 3:58
professionalKreativeKai20-Jun-08 3:58 
QuestionCOMException Pin
Kevviy19-Jun-08 1:23
Kevviy19-Jun-08 1:23 
AnswerRe: COMException Pin
Noctris19-Jun-08 2:53
Noctris19-Jun-08 2:53 
AnswerRe: COMException Pin
Noctris19-Jun-08 2:54
Noctris19-Jun-08 2:54 
QuestionVB6: How to write a file joiner and splitter? Pin
oohungoo19-Jun-08 1:10
oohungoo19-Jun-08 1:10 
AnswerRe: VB6: How to write a file joiner and splitter? Pin
jzonthemtn19-Jun-08 4:26
jzonthemtn19-Jun-08 4:26 
QuestionWho knows to serial file transfer code Pin
rizal wibksana19-Jun-08 1:06
rizal wibksana19-Jun-08 1:06 
AnswerRe: Who knows to serial file transfer code Pin
jzonthemtn19-Jun-08 4:32
jzonthemtn19-Jun-08 4:32 
QuestionDrop items on specific location in listview Pin
Noctris18-Jun-08 23:13
Noctris18-Jun-08 23:13 
Questionread bitmap and display it back problem Pin
shee_dee8618-Jun-08 21:34
shee_dee8618-Jun-08 21:34 
Questionsql Pin
jacko87318-Jun-08 20:59
jacko87318-Jun-08 20:59 
AnswerRe: sql Pin
Noctris18-Jun-08 22:58
Noctris18-Jun-08 22:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.