zoukankan      html  css  js  c++  java
  • [.Net2.0]如何实现Winform中CheckedListBox的全选与取消和读取所有选中项的文本

     public void checkAllState(bool check)
            
    {
                
    for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
                
    {
                    
    this.checkedListBox1.SetItemChecked(i, check);
                }

            }




    public string GetTags()
            
    {
                
    string tags="";
                
    //for (int i = 0; i<checkedListBox1.Items.Count; i++)
                
    //{
                
    //    if (checkedListBox1.GetItemChecked[i])
                
    //    {
                
    //        tags += checkedListBox1.
                
    //    }

                
    //}
                foreach (object itemChecked in checkedListBox1.CheckedItems)
                
    {
                    
    // Use the IndexOf method to get the index of an item.   
                   
    //MessageBox.Show("Item with title: \"" + itemChecked.ToString() + "\", is checked. Checked state is: " + checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(itemChecked)).ToString() + ".");
                    tags += itemChecked.ToString();
                }
       

                
    return tags;
            }

  • 相关阅读:
    假如时光倒流,我会这么学习Java
    一位资深程序员大牛给予Java初学者的学习路线建议
    Java基础部分全套教程.
    假如时光倒流,我会这么学习Java
    Window Location对象
    Window Screen对象
    Window
    easyui datagrid 清除缓存方法
    easyui tree扩展tree方法获取目标节点的一级子节点
    JavaScript 对象
  • 原文地址:https://www.cnblogs.com/goody9807/p/896319.html
Copyright © 2011-2022 走看看