Hello all, Ive been trying to get a helpful progress bar at the bottom
of my app to simply fill up and then disapear.
Unfortunatly, i get this error message when i try to change the .Value
field of the progress bar: "A first chance exception of type
'System.InvalidOperationException' occurred in
System.Windows.Forms.dll" which may be THE most unhelpful error
message ever.
Here is the code:
private void startNetworkProgressBar()
{
tslReadingFromNetwork.Visible = true;
progressBar.Visible = true;
progressBar.Maximum = 100;
progressBar.Minimum = 0;
progressBar.Step = 10;
progressTimer = new System.Timers.Timer();
progressTimer.Interval = 1000;
progressTimer.Elapsed += new
System.Timers.ElapsedEventHandler(progressTimer_El apsed);
progressTimer.Start();
}
void progressTimer_Elapsed(object sender,
System.Timers.ElapsedEventArgs e)
{
if (progressBar.Value == 100)
{
tslReadingFromNetwork.Visible = false;
progressBar.Visible = false;
progressTimer.Stop();
}
else
{
progressBar.Value += 10 ;
}
}
Can anyone see why this isnt working? (Ive tried changing the
progressBar.Value +=10 to .performStep() and that gives the same error.