By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,670 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,670 IT Pros & Developers. It's quick & easy.

Thread+Scope+Null Reference = HELP

P: n/a

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;

//other things

private void xx()
//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

private void formload(.......,.....)

//dont use thread
//Thread thr =new Thread(new ThreadStart(xx));
//call directly function

//other things

but i need to fill dataset with thread

Thanks in advance

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.