Do I need Control.Invoke()?
I'm wondering if this code is ok or if maybe I should be doing Control.Invoke(). Not that I know how to do .Invoke. The code seems to run just fine.
Code:
private void btnLogon_Click(object sender, System.EventArgs e)
{
Thread t = new Thread(new ThreadStart(IncrementProgressBar));
t.Start();
.
.
.
private void IncrementProgressBar()
{
do
{
if (progressBar1.Value >= 95)
{
progressBar1.Value = 0;
}
progressBar1.Value += 5;
Thread.Sleep(250);
}
while (true);
}
I thought there was a trick with modifying a control from a different thread, but not sure if you only need to do that with a method and not a property.
Thanks,
Mike