i have a program that creates two forms , it 2different threads in the sub main, but program execution ends very fast( shows forms for less than a sec , program closed), what can i do about, i dont want to use form.showdialog, any ideas?
Printable View
i have a program that creates two forms , it 2different threads in the sub main, but program execution ends very fast( shows forms for less than a sec , program closed), what can i do about, i dont want to use form.showdialog, any ideas?
Post the code you are using.
for exampe >>
public sum main()
dim a as new form1
dim b as new form2
a.show
b.show
' ***i want to stop program execution here
end sub
these 2forms are created in 1 thread, not the main thread.
so the Q's are..
1.how to stop program execution after showing forms ( not using form.showdialog )
2.if 1 form has closed , i want the thread to abort
and a 3 q is , when a form is hidden, can it still get and recieve data?
thanks for your time...
anyone? anyidea?
A couple questions: Why do you want to do this? Why do you not want to use ShowDialog?
Maybe there is another way to do what you want.
i have a tcpclient object that connects to a server, on the client there is 2 forms, when a is shown b should be hidden, and when b is shown a should be hidden? both forms get data from the tcpclient
what i'm doing is having the tcpclient in the main thread, then having another thread for the 2 forms
i dont want to use showdialog, because when doing so i had problems when hiding and showing
what do you think? any other better ways?
So why do the forms have to be on seperate threads? I would make one form showdialog or Application.Run and the other show from it. The should still hide/show fine.
so what you mean is have everything in 1 thread,right?!
Yes. I don't understand why you need two threads. you can show and hide with 1 in fact its easier with one.
thanks man, i'll start rewriting it in one thread
by the way, whats the differance between showdialog and application.run ?!?
thansk for your time....
ShowDialog just shows the form modally, which if used in sub main then this will halt execution until it is closed. Application.Run assigns the form as belonging to the Main or UI thread, which if done in sub main will mean that the entire app will close with the form.