August 2003
Intermediate to advanced
736 pages
14h 48m
English
Any form—that is, any class that derives from the Form base class—can be shown in one of two ways. Here, it is shown modelessly:
void button1_Click(object sender, System.EventArgs e) {
AnotherForm form = new AnotherForm();
form.Show(); // Show form modelessly
}
Here, a form is shown modally:
void button1_Click(object sender, System.EventArgs e) {
AnotherForm form = new AnotherForm();
form.ShowDialog(); // show form modally
}
Form.Show shows the new form modelessly and returns immediately without creating any relationship between the currently active form and the new form. This means that the existing form can be closed, leaving the new form behind.[1] Form.ShowDialog, on the other hand, shows the form modally and does not return ...
Read now
Unlock full access