[Winform] Message.show()问题..
try
{
if (MessageBox.Show("您确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No)
{
string id = this.UserListView.FocusedItem.Text.ToString();//获取用户点击行焦点
myUserRule.DeleteUser(id);
myUserRule.DataListView(this.UserListView, this.txtID.Text.ToString());
this.txtName.Text = "";
this.txtPassword.Text = "";
this.txtEmail.Text = "";
this.txtAddress.Text = "";
this.txtCode.Text = "";
}
}
catch (Exception)
{
MessageBox.Show("请选择要删除的项!","提示");
}
我点否,还是把数据给删除了,请问我要怎么搞,点否不把数据删除掉呢?
------解决方案--------------------
try
{
if (MessageBox.Show("您确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string id = this.UserListView.FocusedItem.Text.ToString();//获取用户点击行焦点
myUserRule.DeleteUser(id);
myUserRule.DataListView(this.UserListView, this.txtID.Text.ToString());
this.txtName.Text = "";
this.txtPassword.Text = "";
this.txtEmail.Text = "";
this.txtAddress.Text = "";
this.txtCode.Text = "";
}
}
catch (Exception)
{
MessageBox.Show("请选择要删除的项!","提示");
}