views:

299

answers:

2

i have used progress bar in my application..my application is working fine but the progress bar is blank..it does not show the working progress what is wrong??

+9  A: 

Probably you are performing the work in the main GUI thread. This causes all GUI events to be delayed until the task is finished.

Use a BackgroundWorker instead and use its ProgressChanged event to update the progress bar.

Also remember to set WorkerReportsProgress to true on your background worker.

Mark Byers
i have used BackgroundWorker for the progress bar..to show results according to the application running but it is not showing anything its just blank.....
shruti
@shruti: Can you simplify your code to the simplest possible example that still demonstrates the error you are experiencing and then post your code here so we can see it?
Mark Byers
@shruti: See my update regarding WorkerReportsProgress. Maybe that solves your problem.
Mark Byers
yes i did that already..i cant display the code bcoz im doing multiple things and to display all will be very confusing.. im just using the logic that if the work is in progress int percent = (int)((100 * writtenSectors) / burnData.sectorCount);lblStatus.Text = string.Format("Progress: {0}%", percent); statusProgressBar.Value = percent;else{lblStatus.Text = "Progress 0%"; statusProgressBar.Value = 0; }
shruti
A: 
Rakesh Gunijan