2.8.7 Modal Forms

Sample Modal Form

If you want the form to be displayed modally, use the ShowModalForm method. A modal form requires the user to take some action before the form is closed. Typically you use modal forms when you want the user to perform an action before continuing.


Invoke #FormA.ShowModalForm


When the form is running, its ModalResult value is None. When the form is closed the ModalResult value is set to Cancel by default. You can set it to another value such as OK, Yes, No etc. This set of other values does not have predefined meanings.

When the ModalResult is any other value than None, the form is closed automatically.

You use the ModalResult property of buttons if you want to find out which button was pressed to close the form.