Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why doesn't frm.show does not work

Status
Not open for further replies.

jamesa74

Programmer
Jan 10, 2001
20
IL
I have two forms in my project: frmMain (the first default form) and frmStoreDetails.

From the starting form i go to the other one by executing the following code:

frmMain.hide
frmStoreDetails.Show


When i want to go back to the first form i execute the reverse code:

frmStoreDetails.Hide
frmMain.Show


The frmStoreDetails form becomes hidden but the frmMain form is not shown.

Why?

 
When you want to go back to the Main form, you should Unload frmStoreDetails. The show method could also be placed in the Main form

Code:
'in frmMain
Me.Hide
frmMain.Show
Me.Show

'in frmStoreDetails
Unload Me
 
Your code works perfectly with me. How and where do you use the Hide and Show events?

I created the two forms frmMain and frmShowDetail, each with a command button called cmdSwitch. The frmMain form was set as the StartUp object for the project. Following code was used for the button Click event:

for the Main form:
Private Sub cmdSwitch_Click()
frmMain.Hide
frmShowDetail.Show
End Sub


for the Detail form:
Private Sub cmdSwith_Click()
frmShowDetail.Hide
frmMain.Show
End Sub


The code worked as expected. You may possibly add frmxx.Refresh after the frmxx.Show method, as this forces a Repainting of the Screen.

It is not necessary to Unload the forms, as this may imply a performance penalty.

_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top