Threding in vb.net (1.1)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,

What i want to accomplish is to display the main form in my windows application and along with that i want to spurn a thread from my Sub Main that instantiates a dll and displays a form in the dll. And Process the popup form separately from my main form.

This is the gist of the code im running:
Dim obj1 as new classlib.class1
Dim t1 as thread = New Thread(adddressOf t1.ShowMsg)
t1.start()
Application.run(frm1)

Wat happens now is the form that shud display from the class library just flashes and the main form is displayed.
Wat am i doing wrong????
 
Hi there Agarwal,

Tricky Stuff you go there...

Well I am not sure whats exactly wrong here but just as confiramtion..

You have debugged the dll form.. right .. i mean may be the dll form does
close itself. Try popping up a MessageBox in the load event of the dll
form - will that keeps it open till the MessageBox is open?

keep informed of teh update.

Thank You,
rawCoder

Nupur Agarwal said:
Hi ,

What i want to accomplish is to display the main form in my windows
application and along with that i want to spurn a thread from my Sub Main
that instantiates a dll and displays a form in the dll. And Process the
popup form separately from my main form.
This is the gist of the code im running:
Dim obj1 as new classlib.class1
Dim t1 as thread = New Thread(adddressOf t1.ShowMsg)
t1.start()
Application.run(frm1)

Wat happens now is the form that shud display from the class library just
flashes and the main form is displayed.
 
* "=?Utf-8?B?TnVwdXIgQWdhcndhbA==?= said:
What i want to accomplish is to display the main form in my windows application and along with that i want to spurn a thread from my Sub Main that instantiates a dll and displays a form in the dll. And Process the popup form separately from my main form.

This is the gist of the code im running:
Dim obj1 as new classlib.class1
Dim t1 as thread = New Thread(adddressOf t1.ShowMsg)
t1.start()
Application.run(frm1)

Wat happens now is the form that shud display from the class library just flashes and the main form is displayed.
Wat am i doing wrong????

Don't display forms in separate threads whenever possible. Instead, try
to show the form in the main UI thread too and use
'Control.InvokeRequired', 'Control.BeginInvoke', 'Control.Invoke',
etc. to communicate with the form that was created in the other thread.
Notice that Windows Forms form's instance members are not threadsafe.
 
Hi Nupur

It is C# and under construction however probably intresting for your
questions.

http://www.pobox.com/~skeet/csharp/multithreading.html

I hope this helps,

Cor
What i want to accomplish is to display the main form in my windows
application and along with that i want to spurn a thread from my Sub Main
that instantiates a dll and displays a form in the dll. And Process the
popup form separately from my main form.
This is the gist of the code im running:
Dim obj1 as new classlib.class1
Dim t1 as thread = New Thread(adddressOf t1.ShowMsg)
t1.start()
Application.run(frm1)

Wat happens now is the form that shud display from the class library just
flashes and the main form is displayed.
 
Back
Top