简体   繁体   中英

How to show progress bar while attaching files in C#

I am attaching file for mail through C#. I am using below code:

  Attachment data = new Attachment(fileName);
  mailMsg.Attachments.Add(data);

I want to show a progress bar while attaching file. How can I do this?

Unless the mailMsg object has some kind of progress event, you probably can't get the progress for a single attatchment.

However, if you are attatching multiple files, you can report the ratio of files completed to total files as a percentage instead. To do that, add a ProgressBar to your window, then update the value of it after each file is done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM