tags:

views:

72

answers:

2

I have a circular progress indicator. I'd like to add this progress bar to an application I'm working on but don't know how to wire it up correctly.

In my app, I want to hit the "Process" button and have the progress bar displayed while the data is being processed. When the processing is complete, I want the progress bar to hide.

I don't want the processing to occur AFTER the progress bar is hidden. I want the progress bar to run concurrently with the data processing (like a progress bar should work). I don't remember the steps but at one point this was happening.

What do I need to do? Can you recommend and simple examples that show how to implement a progress bar?

A: 

You should run your process in a seperate thread and while that thread is running you can have your progress indicator running on the GUI thread. (If you want your application to be blocked while the process is running) With a callback delegate you can let your GUI thread know the state of the running process and whether to kill the progress indicator (when process is finished) or to keep it running.

Tony
+1  A: 

This is what the BackgroundWorker class is made for. The example in the documentation shows a long running work thread, which reports progress and updates a progress bar on the UI.

Will Eddins