MessageBoxButtons Enumeration
Specifies constants defining which buttons to display on a MessageBox.
[Visual Basic] <Serializable> Public Enum MessageBoxButtons [C#] [Serializable] public enum MessageBoxButtons [C++] [Serializable] __value public enum MessageBoxButtons [JScript] public Serializable enum MessageBoxButtons
Remarks
This enumeration is used by the MessageBox class.
Members
| Member name | Description |
|---|---|
| AbortRetryIgnore Supported by the .NET Compact Framework. | The message box contains Abort, Retry, and Ignore buttons. |
| OK Supported by the .NET Compact Framework. | The message box contains an OK button. |
| OKCancel Supported by the .NET Compact Framework. | The message box contains OK and Cancel buttons. |
| RetryCancel Supported by the .NET Compact Framework. | The message box contains Retry and Cancel buttons. |
| YesNo Supported by the .NET Compact Framework. | The message box contains Yes and No buttons. |
| YesNoCancel Supported by the .NET Compact Framework. | The message box contains Yes, No, and Cancel buttons. |
Example
[Visual Basic] Protected Sub button1_Click(sender As Object, e As System.EventArgs) If textBox1.Text = "" Then MessageBox.Show("You must enter a name.", "Name Entry Error", _ MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Else ' Code to act on the data entered would go here. End If End Sub [C#] protected void button1_Click(object sender, System.EventArgs e) { if(textBox1.Text == "") { MessageBox.Show("You must enter a name.", "Name Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { // Code to act on the data entered would go here. } } [C++] protected: void button1_Click(Object* /*sender*/, System::EventArgs* /*e*/) { if(textBox1->Text->Equals(S"")) { MessageBox::Show(S"You must enter a name.", S"Name Entry Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); } else { // Code to act on the data entered would go here. } }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Windows.Forms
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)