Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Click a button on one form and open another.

Posted on 2000-05-02
6
Medium Priority
?
236 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
Technology Partners: 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:
Brendt Hess earned 40 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

618 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