Hi, Im using a timer every 1 second to update a datagridview, but Im
haveing problems getting it to run on a seperate thread. At the moment
the form freezes when the thread runs, I think its because im firing
the thread with in the timer, Ive tried fireing the timer from thread
start. This is my trimmed code;
private void timer1_Tick(obj ect sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(liv eprices));
thread.IsBackgr ound = true;
thread.Start();
}
public delegate void onliveprices();
private void liveprices()
{
if (InvokeRequired )
{
BeginInvoke(new onliveprices(li veprices));
}
else
{
dowork
puts data into dateset and adds new rows to table
adds table to datagridview
}
}
I need to run liveprices every second, and I need to resize/move the
form. At the momment I cant because of freezing.
I tried Thread thread = new Thread(new ThreadStart(tim er.start);
thread.IsBackgr ound = true;
thread.Start(); but that froze all together.
RegardS Robert
haveing problems getting it to run on a seperate thread. At the moment
the form freezes when the thread runs, I think its because im firing
the thread with in the timer, Ive tried fireing the timer from thread
start. This is my trimmed code;
private void timer1_Tick(obj ect sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(liv eprices));
thread.IsBackgr ound = true;
thread.Start();
}
public delegate void onliveprices();
private void liveprices()
{
if (InvokeRequired )
{
BeginInvoke(new onliveprices(li veprices));
}
else
{
dowork
puts data into dateset and adds new rows to table
adds table to datagridview
}
}
I need to run liveprices every second, and I need to resize/move the
form. At the momment I cant because of freezing.
I tried Thread thread = new Thread(new ThreadStart(tim er.start);
thread.IsBackgr ound = true;
thread.Start(); but that froze all together.
RegardS Robert
Comment