Monthly Archives: March 2018

Modeless vs Modal Dialog

Simple explanation of the differences between modeless and modal dialogs.

win1 dialog

Show() – Modeless

  • Doesn’t stop executing.
  • Can show and create several windows and interact all at once.

ShowDialog() – Modal

  • Intercepts code execution.
  • Stops interaction with other windows.
  • Ideal for presenting the user with a choice that must be made before continuing.
  • When a form is closed the form object and all it’s control information still exists until the referencing variable goes out of scope:

Form1 myForm = new Form1();
myForm .ShowDialog();
....lots of code here.....
myForm.Dispose();

Advertisements