R
RobcPettit
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(object sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(liveprices));
thread.IsBackground = true;
thread.Start();
}
public delegate void onliveprices();
private void liveprices()
{
if (InvokeRequired)
{
BeginInvoke(new onliveprices(liveprices));
}
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(timer.start);
thread.IsBackground = 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(object sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(liveprices));
thread.IsBackground = true;
thread.Start();
}
public delegate void onliveprices();
private void liveprices()
{
if (InvokeRequired)
{
BeginInvoke(new onliveprices(liveprices));
}
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(timer.start);
thread.IsBackground = true;
thread.Start(); but that froze all together.
RegardS Robert