Showing Form in New Thread?

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

Hi

I have a Form that on Form_Load() does some heavy database reading and I
want to show that as a progressbar ontop of the main window..

I want to create a smaller Form with a progressbar.. and then in the main
form, start a new thread that opens that small form and for each progress
the heavy operation send a new value to the small form thru an event.

I have managed to run a function or a sub in another thread but I can't
figure out how to load a whole window in a new thread and keep sending new
messages to it?

Working with VB.NET and framework 1.1

best regards/
Lars Netzel
 
Lars,

The best to do this is to create and update the progress bar form in
the main UI thread. The worker thread will use Invoke or BeginInvoke
from an existing Form to marshal the execution of a delegate onto the
UI thread to accomplish this.

Brian
 
Idealy you should not be calling Window functions from anything but the
main AppDomain thread. You should call Invoke on any form control or by
getting the AppDomain thread object.

You then need to Invoke a function that will launch the Dialog. You can
signal to the Dialog using the same method.
 
Back
Top