You need to break your DoWork method down into reportable progress and then call ReportProgress Take for example the following: private void Something_DoWork(object sender, DoWorkEventArgs e) { // If possible, establish how much there is to do int totalSteps = EstablishWorkload(); for ( int i=0; iReportProgress(50, null); // some work (sender as BackgroundWorker). ReportProgress(60, null); // some work (sender as BackgroundWorker). ReportProgress(99, null); }.
You need to break your DoWork method down into reportable progress and then call ReportProgress. Take for example the following: private void Something_DoWork(object sender, DoWorkEventArgs e) { // If possible, establish how much there is to do int totalSteps = EstablishWorkload(); for ( int i=0; iReportProgress(25, null); // some work (sender as BackgroundWorker). ReportProgress(50, null); // some work (sender as BackgroundWorker).
ReportProgress(60, null); // some work (sender as BackgroundWorker). ReportProgress(99, null); }.
Nice programming, bad math ;-) (int)(100.0 / totalSteps * i) – Dänu Jan 15 at 15:03.
Just report progress on dowork event private void _bgwLoadClients_DoWork(object sender, DoWorkEventArgs e) { int progresValue0to100 = 75; (sender as System.ComponentModel. BackgroundWorker). ReportProgress(progresValue0to100); //do your jobs.. } it works like this.
You have to manualy call ReportProgress() to raise the ProgressChanged event.
You need to call worker. ReportProgress(percentComplete) in your DoWork method. PercentComplete should be computed based on the total work.
For example: for(int I =0; I! = 100; i++) { // do something worker. ReportProgress(i); } Sometimes it is difficult to partition a job in several chunks to be possible to report the progress.
Unfortunately the BackgroundWorker does not solve this, you have to do it yourself.
Progress must be sent from within the DoWork event by calling the ReportProgress method on the BackgroundWorker. In your case, you can't report any progress because all of the work is being done outside of the DoWork function. You can only report progress before and after the call to getdate(), but not during the call since the BackgroundWorker thread is busy.
I have DoWork calling a method that uses a callback mechanism that reports its progress. The stack would look like this (reversed). Xx_DoWork myMethod callbackMethod I want callbackMethod to call ReportProgress.
Is that allowed if I pass the worker object as a param down to callbackMethod?
Modify the WorkReportProgress property of the backgroundworker object to true either in the properties window or in code.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.