Solved

Click a button on one form and open another.

Posted on 2000-05-02
6
190 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
6 Comments
 
LVL 9

Expert Comment

by:Ruchi
Comment Utility
Use "Unload Form1"
0
 
LVL 28

Expert Comment

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

Expert Comment

by:Ruchi
Comment Utility
Try something like this..

Private Sub mnuFileOpen_Click()
Unload Form1
Form2.Show
End Sub
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 32

Accepted Solution

by:
bhess1 earned 10 total points
Comment Utility
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
Comment Utility
Arazsound, you beat me! ;-)
0
 

Author Comment

by:zippy221
Comment Utility
Thanks-you very much :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now