WinForm Progress Update

G

Guest

Hi,

I'm building my first Windows application using C#.

My Windows application sends newsletter to our subscribers by email. Our
newsletter is sort of "customized" so my application has to build the
newsletter for each individual subscriber before sending it out. Now the
whole newsletter sending process to all the subscribers is a very long
process and I'd like to keep my users updated throughout the whole time. I'd
like to accomplish this by having a big text box in my WinForm to display all
the progress messages. In my the various methods of my application I'll keep
updating that text box to display, for example, "Missing email address for
user ABC", "Newsletter has been sent to all New York subscribers" etc etc,
and finally "Task done" after it has finished.

Now the problem is when I run the program, it just goes into a blank and
does it's processing. All the updating messages will only be shown at the end
of the process and that defeats the whole purpose.

What can I do so that my application will keep informing the user of it's
progress?


ywb.


PS. I'll also have a ProgressBar in my WinForm and kind of fill up the bar
to reflect the progress, but I haven't got to that yet.
 
J

Jon Skeet [C# MVP]

WB said:
I'm building my first Windows application using C#.

My Windows application sends newsletter to our subscribers by email. Our
newsletter is sort of "customized" so my application has to build the
newsletter for each individual subscriber before sending it out. Now the
whole newsletter sending process to all the subscribers is a very long
process and I'd like to keep my users updated throughout the whole time. I'd
like to accomplish this by having a big text box in my WinForm to display all
the progress messages. In my the various methods of my application I'll keep
updating that text box to display, for example, "Missing email address for
user ABC", "Newsletter has been sent to all New York subscribers" etc etc,
and finally "Task done" after it has finished.

Now the problem is when I run the program, it just goes into a blank and
does it's processing. All the updating messages will only be shown at the end
of the process and that defeats the whole purpose.

What can I do so that my application will keep informing the user of it's
progress?

You need to use threads.

See http://www.pobox.com/~skeet/csharp/threads/winforms.shtml for more
about GUI threading. .NET 2.0 also provides some extra support which
isn't covered there.
 
G

Guest

Thanks, Jon! I think the link you gave me is exactly the info I need. I just
need some time to digest and understand it...

Where can I find more info on the "extra support" for .Net 2.0 which you
mentioned?
 
J

Jon Skeet [C# MVP]

WB said:
Thanks, Jon! I think the link you gave me is exactly the info I need. I just
need some time to digest and understand it...

Where can I find more info on the "extra support" for .Net 2.0 which you
mentioned?

I'm not sure whether there are any pages which have all the information
together, to be honest. If you look up BackgroundWorker in MSDN that
will give you some of it. I can't currently remember the name of the
class which helps with displaying progress at the moment, which is
irritating...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top