Thread and problem
-
hi I have one threat for calculating but i need some progress bar to do visualisation of step of calculation how to do that??? good bye best regards
-
Look in the C# Windows Forms / C# Controls menu here at CodeProject. There is an entire section on Progress Controls.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does"
Christian Graus in the C# forumled mike
-
You have to tell the ProgressBar to update, but be careful not to directly access UI elements from a different thread than the one they were created in. So you should define a delegate, for example
private delegate void SetProgressValueDelegate(int val);
and a method in your class to update the ProgressBar (its signature must match the delegate):
private void SetProgressValue(int val)
{
progressBar1.Value = val;
}Then you can safely invoke the method from your thread by calling:
Invoke(new SetProgressValueDelegate(SetProgressValue), new object[] { newValue });
where
newValue
is the value to set the ProgressBar to. Regards, mav -- Black holes are the places where god divided by 0...