Share via


Visual Basic Reference

Hide Method

See Also    Example    Applies To

Hides an MDIForm or Form object but doesn't unload it.

Syntax

object.Hide

The object placeholder represents an object expression that evaluates to an object in the Applies To list. If object is omitted, the form with the focus is assumed to be object.

Remarks

When a form is hidden, it's removed from the screen and its Visible property is set to False. A hidden form's controls aren't accessible to the user, but they are available to the running Visual Basic application, to other processes that may be communicating with the application through DDE, and to Timer control events.

When a form is hidden, the user can't interact with the application until all code in the event procedure that caused the form to be hidden has finished executing.

If the form isn't loaded when the Hide method is invoked, the Hide method loads the form but doesn't display it.

Note   When closing a modal form that has been opened from another modal form, the following code worked in previous versions of Visual Basic:

Me.Hide
Me.Hide ' This now causes an error.

In current versions of Visual Basic, this code now fails on the second Me.Hide. You can substitute Me.Hide with Me.Visible = False as shown below:

Me.Visible = False
Me.Visible = False ' No error occurs.