hi,
i want to ask smt about databinding, threading etc.
this is situation:
lets say: i have a type dataset (name: "dsall")
it has datatables table1 , table2
threre are adapters which fills these and ,datagrids etc which is
databounded to this dataset
then i write this code to FORM_LOAD
//create thread in order not to wait getting process
private void formload(.......,.....)
{
Thread thr =new Thread(new ThreadStart(xx));
thr.isBackGround = true;
thr.Start();
//other things
}
private void xx()
{
adapter1.Fill(dsAll.Table1);
adapter1.Fill(dsAll.Table2);
//etc etc..
}
here is problem
when this code is executed, Null Reference exception is thrown
as i understand adapter1 creates datatable in thread scope and because
thread is ended, garbage collector collects datatable so i get null
reference exception, i say this because if i use this form there is no
error.
private void formload(.......,.....)
{
//dont use thread
//Thread thr =new Thread(new ThreadStart(xx));
//thr.Start();
//call directly function
xx();
//other things
}
but i need to fill dataset with thread
Thanks in advance
Erdem...