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

  • 相关阅读:
    Hystrix源码分析(一)
    docker虚拟ip和项目地ip冲突问题解决
    Hystrix入门demo
    为什么spirng扫描到@compent会把对象注册到容器上
    hive安装与基本操作
    hadoop基本安装
    spring session 存到数据库的设置
    React加Ant Design实现的一个登陆界面及小案例
    一个获取天气预报数据的小案例
    React学习笔记案例2
  • 原文地址:https://www.cnblogs.com/goody9807/p/896319.html
Copyright © 2011-2022 走看看