如题

解决方案 »

  1.   

    我记得应是一次性取得Checked
    clb.CheckedItems
      

  2.   

    private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
          {
             if(e.NewValue==CheckState.Unchecked)
             {
                 //code...
             }
    }
      

  3.   


    代码见下参考
    foreach (Control control1 in tabControl1.Controls)
                    {
                        foreach (Control control2 in control1.Controls)
                        {
                            if (((CheckBox)control2).Checked)
                            {
                                sSqlText = "insert into UserRights values " +
                                    "('" + textBox1.Text.Trim() + "'," +
                                    " '" + control2.Name + "',1)";
                            }
                            else
                            {
                                sSqlText = "insert into UserRights values " +
                                    "('" + textBox1.Text.Trim() + "'," +
                                    " '" + control2.Name + "',0)";
                            }
                            ClassDB1.ExecuteSqlText(sSqlText);
                        }
                    }
      

  4.   


    for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {
                    if (checkedListBox1.GetItemChecked(i))
                    {
                        MessageBox.Show(checkedListBox1 .GetItemText(i)+"选中");
                    }
                }
      

  5.   

    好久没用,忘了这个方法GetItemChecked谢谢楼上几位朋友帮忙啦~~