Hide Method

See Also1HX951              Example2504FU1>Low

Hides a form, but does not unload it.




The argument form is the name of the form or MDI form to hide.

When a form is hidden, it is removed from the screen and its Visible property is set to False .  A hidden form's controls are not accessible to the user, but they are available to the running Visual Basic program, to other processes that may be communicating with the application through dynamic data exchange (DDE), and to timer events.

When a form is hidden, control does not return to the user until all code in the event procedure that caused the form to be hidden has finished executing.

If the form is not loaded when the Hide method is invoked, it is loaded, but not shown.

While you can use the Hide method to hide an MDI form, you cannot hide an MDI child form.

See Also

Load StatementGU0759

Show Method2IF9Z3Q

Unload Statement17FKE8Z

Visible Property32KNZA4

Hide Method Example

The example uses the Hide method to hide a form.  To try this example, paste the code into the Declarations section of a non-MDI form.  Then press F5 and click the form.


Sub Form_Click ()

   Dim Msg                               ' Declare variable

   Hide                                  ' Hide form.

   Msg = "Choose OK to make the form reappear."

   MsgBox Msg                            ' Display message.

   Show                                  ' Show form again.

End Sub