Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simply send it a text string to display.
- // False == NO, True == Yes! & default button number 1.
- static public bool YesNoDlg(string text)
- { return YesNoDlg(text, 1); }
- // Overloaded method below...
- static public bool YesNoDlg(string text, int defaultButton)
- // Excellent: ReUse This For ALL such. (GASIT Standard)
- {
- const string msg = "User Input Required";
- bool flag;
- if (defaultButton == 1)
- { // If only string is passed, defaults to this...
- flag = MessageBox.Show(
- text, msg,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button1 // YES!
- ) != DialogResult.No;
- }
- else
- {
- if (defaultButton == 2)
- {
- flag = MessageBox.Show(
- text, msg,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button2 // NO!
- ) != DialogResult.No;
- }
- else
- {
- flag = MessageBox.Show(
- text, msg,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button3 // Cancel?
- ) != DialogResult.No;
- }
- }
- return flag;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement