Ajay_Kumar
Ajay_Kumar

Reputation: 1387

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?

Upvotes: 2

Views: 752

Answers (1)

Nobody
Nobody

Reputation: 4841

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.

Upvotes: 1

Related Questions