Solved

Why my second form is missing after using another application in Visual Basic 6

Posted on 2014-07-22
4
211 Views
Last Modified: 2014-07-22
Hi guys,

I have form-A and Form-B, the form A is my main form and has the menu and also remains visible until the application is closed, when I choose an option from main menu, the program opens Form-B that becomes the active window and the main form becomes disabled. When I close Form-B, the Form-A becomes enabled again, so everything works perfect.

The problem is when I use another application let's say:

I have my main form-A and my form-B running suddenly, I open MSWord to do something and it becomes the active window, at this point everything is ok, but when I return to my Application, the form-B is missing and only see the Form-A, but disabled. So Where is my Form-B?

Thank you so much guys in advance.
0
Comment
Question by:elm9999
4 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 40212415
the form b is in the background

What you should do instead of disabling it is to hide it
Set form1.visible = false

Or use it like an MDI

if you minimise word, you will see form2 is still there, behind it
0
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40212430
You can also on the form_show of form a
if  not forma.enabled then formb.show
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 40212618
When you display the second form, display it as modal and specify the current form as the owner:
http://msdn.microsoft.com/en-us/library/aa244181(v=vs.60).aspx
Private Sub cmdShowResults_Click()
   ' Show a modal form named frmResults.
   frmResults.Show vbModal, Me
End Sub

Open in new window

0
 

Author Closing Comment

by:elm9999
ID: 40212772
Thank you so much guys.

Its' already done with Mike option.

Thank's
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

863 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

22 Experts available now in Live!

Get 1:1 Help Now