How do I display modeless and modal forms?
Displaying Modeless Forms
To display a modeless form, after insantiating the form, call its Show method.In C#:
MyForm.Show();In Visual Basic .NET:
MyForm.Show()Displaying Modal Forms
To display a modal form, after instantiating the form, call its ShowDialog method.In C#:
MyForm.ShowDialog();In Visual Basic .NET:
MyForm.ShowDialog()When a modal form is displayed, the code immediately following the call to ShowDialog is not executed until the modal form is closed.
Note: If your application is localized, you should use the MM .NET Form Manager's Show and ShowDialog methods rather than calling these methods directly on the form. For details, see the MM .NET topic Showing Localized Windows Forms
Specifying a Form Owner
You can specify that one form owns another form by passing a reference to the owner form when you show the owned form. When a form is owned by another form, it is minimized and closed with the owner form.In C#:
MyForm.Show(this);In Visual Basic .NET:
MyForm.Show(Me)Alternately, you can simply store a reference to the owner form in the owned form's Owner property.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
