Export (0) Print
Expand All
Expand Minimize

MessageBoxButtons Enumeration

Specifies constants defining which buttons to display on a MessageBox.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public enum MessageBoxButtons
public enum MessageBoxButtons
public enum MessageBoxButtons

 Member nameDescription
Supported by the .NET Compact FrameworkAbortRetryIgnoreThe message box contains Abort, Retry, and Ignore buttons. 
Supported by the .NET Compact FrameworkOKThe message box contains an OK button. 
Supported by the .NET Compact FrameworkOKCancelThe message box contains OK and Cancel buttons. 
Supported by the .NET Compact FrameworkRetryCancelThe message box contains Retry and Cancel buttons. 
Supported by the .NET Compact FrameworkYesNoThe message box contains Yes and No buttons. 
Supported by the .NET Compact FrameworkYesNoCancelThe message box contains Yes, No, and Cancel buttons. 

This enumeration is used by the MessageBox class.

private 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.
   }
}

protected void button1_Click(Object sender, System.EventArgs e)
{
    if (textBox1.get_Text().Equals("")) {
        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.
    } 
} //button1_Click

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft