This is a migrated thread and some comments may be shown as answers.

radProgressbar does not update in Workerthread

1 Answer 238 Views
ProgressBar
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 26 Jul 2010, 06:41 PM
I have an application that fires of a workerthread where I do all my loading from a database.  The workerthread is fired off from the Form.Load event and unless I put text into the radProgressBar, no information is being displayed on the screen.  Also I cannot figure out how the set the percent value correctly to display.  I have minimum and maximum values set to 1 and 100 and during progress worker thread event I send in correct percentage but it never updates percent in any of my forms....Help would greatly be appricated as we are trying to ship this product out this week.

According to documentation, I doing everything correctly...

Load Code:

radProgressBarSearchLocal.Minimum = 0;

radProgressBarSearchLocal.Maximum = 100;

radProgressBarSearchLocal.StepWidth = 12;

radProgressBarSearchLocal.Text =

"Loading Collection...";

 

radProgressBarSearchNetwork.Minimum = 0;

radProgressBarSearchNetwork.Maximum = 100;

radProgressBarSearchNetwork.StepWidth = 12;

radProgressBarSearchNetwork.Text =

"Loading Collection...";

 

radProgressBarSearchOutlook.Minimum = 0;

radProgressBarSearchOutlook.Maximum = 100;

radProgressBarSearchOutlook.StepWidth = 12;

radProgressBarSearchOutlook.Text =

"Loading Collection...";

 

totalitems = 0L;

processeditems = 0L;

radBack.Enabled =

false;

 

radCancel.Enabled =

false;

 

radNext.Enabled =

false;

 

radFilterLDCollection.Enabled =

false;

 

radFilterNDCollection.Enabled =

false;

 

radFilterOutlookCollection.Enabled =

false;

 

radSearchLDCollection.Enabled =

false;

 

radSearchOutlookCollection.Enabled =

false;

 

radSearcNDhCollection.Enabled =

false;

 

 

Program.myIndex = null;

 

 

this.Cursor = Cursors.WaitCursor;

 

whichbackground = 1;

backgroundWorker1.RunWorkerAsync();


 

private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)

 

{

 

switch (Program.activeCollection)

 

{

 

case COLLECTION_TYPE_LOCALDRIVES:

 

radProgressBarSearchLocal.Text = e.UserState.ToString();

radProgressBarSearchLocal.Value1 = e.ProgressPercentage;

radProgressBarSearchLocal.ProgressBarElement.PerformStepValue1();

radProgressBarSearchLocal.Refresh();

 

break;

 

 

case COLLECTION_TYPE_NETWORKDRIVES:

 

radProgressBarSearchNetwork.Text = e.UserState.ToString();

radProgressBarSearchNetwork.Value1 = e.ProgressPercentage;

radProgressBarSearchNetwork.ProgressBarElement.PerformStepValue1();

radProgressBarSearchNetwork.Refresh();

 

break;

 

 

case COLLECTION_TYPE_OUTLOOK:

 

radProgressBarSearchOutlook.Text = e.UserState.ToString();

radProgressBarSearchOutlook.Value1 = e.ProgressPercentage;

radProgressBarSearchOutlook.ProgressBarElement.PerformStepValue1();

radProgressBarSearchOutlook.Refresh();

 

break;

 

}

}


Progress event code:

Ray McCue
Software Consultant
ecWest LLC

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 02 Aug 2010, 01:13 PM
Hi Raymond,

I am not able to exactly determine the exact reason for the wrong behavior, because I am missing some code parts of your approach. Generally, in order to set the RadProgressBar value to the ProgressPercentage that comes from the arguments of the ProgressChanged event, you should set the WorkerReportsProgress property of the BackgroundWorder to true, and you should also call the ReportProgress property of the worker in the DoWork event handler, passing the appropriate progress percentage. Please find attached a sample project which demonstrates the complete approach.

If you decide to just call the PerformStepValue1() method instead of setting the Value1 property to a custom ProgressPercentage value, you should initially set the Value1 property, but not the StepWidth property. StepWidth property defines the space between the separators in RadProgressBar when it is in Dash mode, while PerformStepValue1() increases the progress of RadProgressBar depending on the Value1 value.

Greetings,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ProgressBar
Asked by
Raymond
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or