Show Method

See Also8Z8F0DW                 Example3T0SKW>Low

Displays a form.

Syntax

[form.]Show [style]

Remarks

The Show method has these parts:

Part                 Description

 

form                 Form or MDI form to display. If not specified, the form associated with the current form module is displayed.

style                 Integer value that determines if the form is modal1L0L9FR or modeless18PSOBN.  If style is 0, the form is modeless; if style is 1, the form is modal.

 

If the specified form is not loaded when the Show method is invoked, Visual Basic automatically loads it.

When a modeless form is displayed, Visual Basic code that occurs after the Show method is executed as it is encountered.  When a modal form is displayed, no Visual Basic code after the Show method is executed until the form is hidden or unloaded.

When displaying a modal form, no user input (keyboard or mouse) can occur in any other form until the modal form is hidden or unloaded.  The program must hide or unload a modal form (usually in response to some user action) before further user input can occur.  MDI forms cannot be shown modally.

Although other forms in your application are disabled when a modal form is displayed, other applications are not.

The startup form of an application is automatically shown after its Load event is executed.

 

Note   Controls are not painted immediately after the form is shown.  If you experience problems painting controls, use the DoEvents statement or the Refresh method to allow the Paint event to complete processing.

 


See Also

Activate Event2E06TW

Hide MethodGU6180

Load StatementGU0759

Unload Statement17FKE8Z

Visible Property32KNZA4


Show Method Example

The example uses the Show method to show a hidden 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