Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Control to another form

Status
Not open for further replies.

RobertMottram

Programmer
Apr 25, 2002
39
0
0
GB
I have an application which opens on form, once the user has entered some parameters I want to close that form and open another. The problem is that if I close the first form the application stops. What is the best way to do this. I have just moved from VB 6 where this was not a problem as the program continued to run until the last form was closed.

I have got to this point
Start form is form1
Sub Form1_load
....Code....
Dim form2 as new form2
from2.show
End Sub
Sub From2_load
....Code....
form1.close
...code...
End Sub

This will all work, but when from1 is close the whole program closes and I don't want this.

I am sure this is a very simply problem, but I have got totaly stuck on it!

Thanks for any help you may be able to give

Rob
 
You've set the form as your startup object. Try creating a new class that instantiates the form, and set the class to be your startup object.

Chip H.
 
I tried that as well. The problem then was as soon as the form was opened the sub main contniued to run, and once it got to the end of the sub the prgram closed. I could not think of a way to stop the procedure getting to teh end and so finishing my program
 
Try using the "ShowDialog" method call on your Form object to display it.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top