/*asterisk=information::(星号)对话框背景感叹号
error=hand=stop::红色背景x
exclamation=warning:(呼喊)黄色三角背景感叹号
none:什么符号都没有
question:对话框背景问号*/
private void btnSubmit_Click(object sender, EventArgs e)
{
if (txtName.Text.Trim() == string.Empty)
{
DialogResult dialogResult = MessageBox.Show("确认要输入用户名?", "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Yes)
{
MessageBox.Show("请输入用户名!", "title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtName.Focus();
return;
}
else
{
MessageBox.Show("如果没有输入用户名,就不能继续输入!");
txtName.Focus();
return;
}
}
else
{
MessageBox.Show("ok");
}
}
messagebox的弹出消息
最新推荐文章于 2019-06-08 16:04:48 发布