我正在尝试创建一个 if 语句来提示我询问我是否确定要选中该复选框。如果该复选框已被选中,则只需取消选中该框。以下是我似乎无法开始工作的内容。谢谢!如果有人有这样做的简单方法,请告知。
if (checkBox15.Checked == false)
{
MessageBox.Show("Are you sure you want to check this?", "Prompt", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Updatelist();
}
else
{
checkBox15.Checked = false;
return;
}
}
else if (checkBox15.Checked == true)
{
checkBox15.Checked = false;
return;
}
最佳答案
你错过了if(
if(MessageBox.Show("Are you sure you want to check this?",
"Prompt",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
Updatelist();
}
else
{
checkBox15.Checked = false;
return;
}
关于c# - 如果选中复选框,请执行其他操作取消选中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20679117/