J
JoeB
Hi,
I posted this in the dotnet.csharp forum, but was told to come here to the
CF forum
This code does not run, the application throws when i call Invoke;
private delegate void DelegateStarter();
private void CycleProgressBar()
{
int x = 0;
while( true )
{
progressBar1.Value = x;
x += 10;
if( x > 100 )
x = 0;
Thread.Sleep(200);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
DelegateStarter dls = new DelegateStarter( CycleProgressBar );
progressBar1.Invoke( dls ); // *** THROWS ***
}
Appereently, a progressbar cannot be updated on the main thread, so i need
to Control.Invoke to do the updating, but cant get it working. Can someone
help me?
Joe
I posted this in the dotnet.csharp forum, but was told to come here to the
CF forum
This code does not run, the application throws when i call Invoke;
private delegate void DelegateStarter();
private void CycleProgressBar()
{
int x = 0;
while( true )
{
progressBar1.Value = x;
x += 10;
if( x > 100 )
x = 0;
Thread.Sleep(200);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
DelegateStarter dls = new DelegateStarter( CycleProgressBar );
progressBar1.Invoke( dls ); // *** THROWS ***
}
Appereently, a progressbar cannot be updated on the main thread, so i need
to Control.Invoke to do the updating, but cant get it working. Can someone
help me?
Joe