tags:

views:

88

answers:

2

how can I add a progress bar in vb.net while sending an email message?

+2  A: 

Just before you call SmtpClient.SendAsync(), set the ProgressBar.Visible property to True. Set it to False in an event handler for the SmtpClient.SendCompleted event. The PB must have its Style property set to Marquee.

You cannot otherwise give accurate progress info, neither the StmpClient nor the MailMessage class has an event that tells you how much of the job got done.

Hans Passant
A: 

You can use a timer control and make the progressbar move in the handler. You can reset the progress bar back to zero when it reaches the max value. This won't reflect the actual progress, but it will give the user something to watch and show that the application is not locked up.

xpda