我在ItemCheck事件中是这么写得
        private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            CheckedListBox clb = (CheckedListBox)sender;
            for (int x = 0; x != checkedListBox1.CheckedItems.Count ; x++)
            {
                if (x != 0)
                {
                    clb.Tag = true;
                }
                else
                {
                    clb.Tag = false;
                }
            }
ValidateOK();
但是经过试验,必须选中三个以上的项目才能验证,到底是怎么回事呀

解决方案 »

  1.   

    private   void   checkedListBox1_ItemCheck(object   sender,   System.Windows.Forms.ItemCheckEventArgs   e) 

    if(e.NewValue==CheckState.Checked) 
    {}
    }string s=String.Empty;
    for (i = 0; i <=checkedListBox1.Items.Count-1; i++)
    {
      if(checkedListBox1.GetItemChecked(i))
      {
      s = checkedListBox1.Items[i].Value+",";
      }
    }
    foreach(object item in checkedListBox1.Items) {
      }
      

  2.   


    for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {
                    if (checkedListBox1.GetItemChecked(i))
                    {
                        BaseParser cli = null;
                        switch (checkedListBox1.GetItemText(checkedListBox1.Items[i]))
                        {
                            case "ssw":
                                cli = new Soso();
                                bplist.Add(cli);
                                break;
                            case "ww":
                                cli = new Wenwen();
                                bplist.Add(cli);
                                break;
                            case "ss":
                                cli = new SosoBlog();
                                bplist.Add(cli);
                                break;
                            case "sa":
                                cli = new Sogou();
                                bplist.Add(cli);
                                break;
                            case "a":
                                cli = new _1688();
                                bplist.Add(cli);
                                break;
                            case "q":
                                cli = new Xywy();
                                bplist.Add(cli);
                                break;
                            default:
                                break;
                        }
                    }
                }
      

  3.   

    不知道楼主是不是这个意思!
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();            //add 3 items to collection checkedListBox
                //and make sure one item is chosen,
                checkedListBox1.Items.Add("KDS",true);
                checkedListBox1.Items.Add("2");
                checkedListBox1.Items.Add("3");            //listChecked就是处于选中状态的所有item集合
                CheckedListBox.CheckedItemCollection listChecked = checkedListBox1.CheckedItems;
                
                for (int i = 0; i < listChecked.Count; i++)
                {
                    //将被选中item的text打印出来
                    MessageBox.Show("{0}", listChecked[0].ToString());            }
            }
        }}
      

  4.   

    如果楼主要确定没有项被选中只需要检查listChecked.Count是否为0即可。为0,则没有项被选中了。
      

  5.   

    我确实是检查checkedListBox1.CheckedItems.Count的值是否为空了,请看代码,但是就是不能确定checkedListBox中的项是否全部没有选中。