hi every one
i want to give data from database and bound to a grid from a thread i write this sample code:
*************** *************** ********
private void thr()
{
dataGridView1.D ataSource = null;
linq1DataContex t da = new linq1DataContex t();
var p = from cust in da.Customers select cust;
dataGridView1.D ataSource = p;
dataGridView1.R efresh();
}
private void sbButton1_Click (object sender, EventArgs e)
{
th = new Thread(new ThreadStart(thr ));
th.IsBackground = true;
th.Start();
}
*************** *************** *************** *******
and i use sqlserver2000 and northwide database
when i click the button and run thread the grid fills with data but after this the form don't respond
and the grides scrolls dont work.
everyone know how can i fix this problem.
thanks.
i want to give data from database and bound to a grid from a thread i write this sample code:
*************** *************** ********
private void thr()
{
dataGridView1.D ataSource = null;
linq1DataContex t da = new linq1DataContex t();
var p = from cust in da.Customers select cust;
dataGridView1.D ataSource = p;
dataGridView1.R efresh();
}
private void sbButton1_Click (object sender, EventArgs e)
{
th = new Thread(new ThreadStart(thr ));
th.IsBackground = true;
th.Start();
}
*************** *************** *************** *******
and i use sqlserver2000 and northwide database
when i click the button and run thread the grid fills with data but after this the form don't respond
and the grides scrolls dont work.
everyone know how can i fix this problem.
thanks.