MessageBoxButtons 枚举
指定若干常数,用以定义 MessageBox 上将显示哪些按钮
**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)
语法
声明
Public Enumeration MessageBoxButtons
用法
Dim instance As MessageBoxButtons
public enum MessageBoxButtons
public enum class MessageBoxButtons
public enum MessageBoxButtons
public enum MessageBoxButtons
成员
成员名称 | 说明 | |
---|---|---|
AbortRetryIgnore | 消息框包含“中止”、“重试”和“忽略”按钮。 | |
OK | 消息框包含“确定”按钮。 | |
OKCancel | 消息框包含“确定”和“取消”按钮。 | |
RetryCancel | 消息框包含“重试”和“取消”按钮。 | |
YesNo | 消息框包含“是”和“否”按钮。 | |
YesNoCancel | 消息框包含“是”、“否”和“取消”按钮。 |
备注
此枚举由 MessageBox 类使用。
示例
Private 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
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.
}
}
private:
void button1_Click( Object^ sender, System::EventArgs^ e )
{
if ( textBox1->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.
}
}
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
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0