K
kimiraikkonen
Hi,
I have a small app which sends using .NET's SmtpClient Class and sends
well. But the problem is that i placed a marquee-type progress bar to
have an animation and hide by default.
Then i placed "progressbar1.show" code inside send button, but the
problem is that progress bar is shown after the mail is sent / after
operation ends. I want my form displays progress bar at the same time
with mail is being sent.
And during sending process form seems hanged and locked but still
operation is ended successfully after a while. I have searched for
similiar threads with no help and i think i need to insert a kind of
invoking / delegation part into my code to allow my form tointeract
during operation. My code:
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles _btnSubmit.Click
ProgressBar1.Show()
Dim message As New MailMessage(txtfrom.Text, txtto.Text,
txtsubject.Text, txtbody.Text)
Dim emailClient As New SmtpClient("smtp.gmail.com")
Dim SMTPUserInfo As New
System.Net.NetworkCredential(txtSMTPUser.Text +
_ "@gmail.com", txtSMTPPass.Text)
emailClient.UseDefaultCredentials = False
emailClient.Credentials = SMTPUserInfo
emailClient.Port = 587
emailClient.EnableSsl = True
emailClient.Send(message)
MsgBox("Mail was sent successfully", MsgBoxStyle.Information,
"Success!")
End Sub
I have no experience about "invoking types and delagates" and i want
to learn briefly.
If you help and explain about the code i'd be so glad.
Thanks!
I have a small app which sends using .NET's SmtpClient Class and sends
well. But the problem is that i placed a marquee-type progress bar to
have an animation and hide by default.
Then i placed "progressbar1.show" code inside send button, but the
problem is that progress bar is shown after the mail is sent / after
operation ends. I want my form displays progress bar at the same time
with mail is being sent.
And during sending process form seems hanged and locked but still
operation is ended successfully after a while. I have searched for
similiar threads with no help and i think i need to insert a kind of
invoking / delegation part into my code to allow my form tointeract
during operation. My code:
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles _btnSubmit.Click
ProgressBar1.Show()
Dim message As New MailMessage(txtfrom.Text, txtto.Text,
txtsubject.Text, txtbody.Text)
Dim emailClient As New SmtpClient("smtp.gmail.com")
Dim SMTPUserInfo As New
System.Net.NetworkCredential(txtSMTPUser.Text +
_ "@gmail.com", txtSMTPPass.Text)
emailClient.UseDefaultCredentials = False
emailClient.Credentials = SMTPUserInfo
emailClient.Port = 587
emailClient.EnableSsl = True
emailClient.Send(message)
MsgBox("Mail was sent successfully", MsgBoxStyle.Information,
"Success!")
End Sub
I have no experience about "invoking types and delagates" and i want
to learn briefly.
If you help and explain about the code i'd be so glad.
Thanks!