日期:2014-05-17  浏览次数:21952 次

如何实现CheckBoxList单选功能
如何实现CheckBoxList单选功能

------解决方案--------------------
在CheckedChanged里面控制
------解决方案--------------------
以下方法可以实现你的功能
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (checkedListBox1.CheckedItems.Count > 0)
            {

                for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {

                    if (i != e.Index)
                    {

                        this.checkedListBox1.SetItemCheckState(i,

                        System.Windows.Forms.CheckState.Unchecked);

                    }

                }

            }

        }
------解决方案--------------------
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (checkedListBox1.CheckedItems.Count > 0)
            {

                for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {

                    if (i != e.Index)
                    {

                        this.checkedListBox1.SetItemCheckState(i,

                        System.Windows.Forms.CheckState.Unchecked);

                    }

                }

            }

        }  
 

------解决方案--------------------
友情链接: 爱易网 云虚拟主机技术 云服务器技术 程序设计技术 开发网站 APP开发教程
Copyright © 2013-2026 爱易网页 当前在线:1000人  网站在18时6分16秒内访问总人数:214708人 8秒前 38.47%  粤ICP备18100884号-2