Solved

Click a button on one form and open another.

Posted on 2000-05-02
6
223 Views
Last Modified: 2010-05-02
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.
0
Comment
Question by:zippy221
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2770808
Use "Unload Form1"
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2770822
Private Sub mnuFileOpen_Click()
Unload Form1
Form2.Show
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2770831
Try something like this..

Private Sub mnuFileOpen_Click()
Unload Form1
Form2.Show
End Sub
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Accepted Solution

by:
bhess1 earned 10 total points
ID: 2770844
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
 
LVL 9

Expert Comment

by:Ruchi
ID: 2770855
Arazsound, you beat me! ;-)
0
 

Author Comment

by:zippy221
ID: 2771190
Thanks-you very much :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 116
using Access 8 84
Best way to parse out a json string in VB6? 10 288
Assign a value in Excel V-Basic 3 29
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question