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;
            }

  • 相关阅读:
    打开虚拟机导致电脑蓝屏
    jmeter访问接口后返回的数据乱码
    使用jmeter批量对新增账号初始化操作
    使用jmeter参数化时在数据中匹配11位的手机号并分组操作
    vsphere vdp备份情况导出
    grep的完全匹配(不是-w)
    win10右键新建md文件,亲测有效
    信步漫谈之Wiki知识库——搭建dokuwiki
    vim操作学习
    writev函数
  • 原文地址:https://www.cnblogs.com/goody9807/p/896319.html
Copyright © 2011-2022 走看看