在 vb.net 中发送电子邮件时如何使用进度条? [英] How To Use Progress Bar While Sending an Email in vb.net?

查看:27
本文介绍了在 vb.net 中发送电子邮件时如何使用进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在发送电子邮件时在 vb.net 中添加进度条?

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

推荐答案

就在您调用 SmtpClient.SendAsync() 之前,将 ProgressBar.Visible 属性设置为 True.在 SmtpClient.SendCompleted 事件的事件处理程序中将其设置为 False.PB 必须将其 Style 属性设置为 Marquee.

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.

否则您无法提供准确的进度信息,无论是 StmpClient 还是 MailMessage 类都没有一个事件可以告诉您完成了多少工作.

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.

这篇关于在 vb.net 中发送电子邮件时如何使用进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆