MessageBox.Show () has 21 overloads
Popular pop-up popup box
1, a parameter, pop-up window only one option
2, three parameters, the first parameter is to set the text content of the popup message box, the second parameter is to set the text displayed in the title bar of the pop-up window; The third parameter is which buttons are displayed in the specified message box
Like what:
(Lee Brainstorming Lxc)
So how do you know if a user clicked "OK" or "Cancel"?
MessageBox.Show () returns a DialogResult value
Private voidButton1_Click (Objectsender, EventArgs e) {DialogResult Dr= MessageBox.Show ("I'm a small plane! ","I can fly! ", Messageboxbuttons.okcancel); if(dr = =DialogResult.OK) {button1. Text="OK button"; } Else if(dr = =dialogresult.cancel) {button1. Text="It's canceled! "; } }
receive the button that the user clicked
c#-winform-pop-up popup-How do I know which button the user clicked on?