如何在c#checkedListbox中实现确认消息ItemCheck取消选择一个项目

时间:2018-03-18 08:41:53

标签: c# winforms confirmation checkedlistbox

当用户点击“否”时,无论如何都会取消选中checkedListBox1项目,实施此类确认的正确方法是什么?

private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
    {
            if (e.NewValue.ToString() == "Unchecked")
            {
                //Confirmation
                if (MessageBox.Show("Really Remove?","Remove", MessageBoxButtons.YesNo,             MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) ==             System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
}

1 个答案:

答案 0 :(得分:0)

您可以尝试以下内容:

pip install mysqlclient