Adding new Thread to onload

VBNew-B

New member
Joined
Aug 14, 2007
Messages
3
Programming Experience
Beginner
I am trying to load some data from active directory into a treeview however the data is taking a long time to load and I would like to have it run in a backgroundworker or another thread and allow the form to continue to load. All attempts to make this work has been for not.

Can anyone let me know what can be done to get this to work.

Basically what I have done so far is create a backgroundworker and place it in the onload section of my form. added the function and it works but it does not show the form until the backgroundworker finishes..

thanks in advance for any help.
 
Add the BGW from toolbox, do the work in its DoWork event (or call the method that does the work from there). Call bgw.runworkerasync from form Load event.
 
You don't need to do cross-thread calls with the BGW (you wouldn't do it in DoWork!), set it to report progress and use the safe ProgressChanged event if needed, you can report any kind of progress information anytime during the working through the ReportProgress method.
 
Back
Top