Everyone knows the MessageBox.Show() method, that returns DialogResult value after dialog closed.
How can I implement such a method in my dialog class?
class MyDialog : Form {
public static MyDialogResult Show() {};
}
The problem, as you can guess, is that the method returns a value only after user clicks some button in the dialog.
You can also set the DialogResult property on a button. If that button is clicked then the specified value will be returned by the ShowDialog() method.