Hiding MDI child forms
By: Lorenzo Dalla Vecchia Date: 13/07/1998

Although Visual Basic gives you a fit if you try to hide an MDI child form by setting its visible property to false there's no need to give up. Try this little Windows API trick to get the job done!
You will need to declare the API function as in the line below:

Private Declare Function ShowWindow Lib "user32" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Then, to call the function, use a statement like the one that follows:

X = ShowWindow(form.hWnd, 0)

Where forms is the name of the form to make invisible.

The ShowWindow function will return True if the form was not already hidden. Otherwise, it will return False.

This routine will work on forms other than MDI child forms as well. Check out the ShowWindow API function because it can do a whole lot more than just hide forms.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it