Click a button on one form and open another.

Okay, I have two VB 6.0 forms.  When I click on a menu item I want to close one and open the other.  How do I do this?
The first form's name is Form1 and the second form's name is Form2.  The menu item's name is mnuFileOpen.
zippy221Asked:
Who is Participating?
 
Brendt HessConnect With a Mentor Senior DBACommented:
In mnuFileOpen_Click, use code like this:

' If you want to be able to go back to the first form quickly,
'   use the .Hide, otherwise use Unload
'
'Form1.Hide
Unload Form1

Form2.Show   ' loads Form2 if not already loaded

----------------------

Note:
  If you want mnuFileOpen to toggle between the two forms, you can use code like this:

If Form1.Enabled And Form1.Visible Then
  Unload Form1
  Form2.Show
Else   ' assumes one form or the other is shown
  Unload Form2
  Form1.Show
End If
 
0
 
RuchiCommented:
Use "Unload Form1"
0
 
AzraSoundCommented:
Private Sub mnuFileOpen_Click()
Unload Form1
Form2.Show
End Sub
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
RuchiCommented:
Try something like this..

Private Sub mnuFileOpen_Click()
Unload Form1
Form2.Show
End Sub
0
 
RuchiCommented:
Arazsound, you beat me! ;-)
0
 
zippy221Author Commented:
Thanks-you very much :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.