Visual Basic Reference

Show Method

See Also    Example    Applies To

Displays an MDIForm or Form object. Doesn't support named arguments.

Syntax

object**.Show**style, ownerform

The Show method syntax has these parts:

Part Description
object Optional. An object expression that evaluates to an object in the Applies To list. If object is omitted, the form associated with the active form module is assumed to be object.
style Optional. Integer that determines if the form is modal or modeless. If style is 0, the form is modeless; if style is 1, the form is modal.
ownerform Optional. A string expression that specifies the component which "owns" the form being shown. For standard Visual Basic forms, use the keyword Me

Remarks

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

When Show displays a modeless form, subsequent code is executed as it's encountered. When Show displays a modal form, no subsequent code is executed until the form is hidden or unloaded.

When Show displays a modal form, no input (keyboard or mouse click) can occur except to objects on the modal form. The program must hide or unload a modal form (usually in response to some user action) before input to another form can occur. An MDIForm can't be modal.

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

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

Here is an example of how the ownerform argument is used with the Show method:

Private Sub cmdShowResults_Click()
   ' Show a modal form named frmResults.
   frmResults.Show vbModal, Me
End Sub