Dev控件使用CheckedListBoxControl獲取items.count為0 的解決方法

CheckedListBoxControl,我使用DataSource屬性,給其綁定了一個List對象。界面顯示都挺正常的,當若干個項的復選框被選中的后,它的checkedListBoxControl1.CheckedItems也是正常的。

唯獨的問題是在代碼中得到的checkedListBoxControl1.Items.Count 為0,自然就不能遍歷控件的中的所有項。checkedListBoxControl1能夠正確獲得某個Item對象的方法就剩下GetItemValue(idx)、SetItemChecked等。

如果你也遇到這種情況,請使用下面的方法來遍歷所有的Item,并做出相應的處理:

全不選:

        public void ClearCheckState(){int idx = 0;while (checkedListBoxControl1.GetItemValue(idx) != null) { checkedListBoxControl1.SetItemChecked(idx, false); idx++; } }

轉載于:https://www.cnblogs.com/ogre-zl/p/11533616.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/391229.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391229.shtml
英文地址,請注明出處:http://en.pswp.cn/news/391229.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

如何啟動軟件YouTube頻道

Hi, I’m Beau and I run the freeCodeCamp.org YouTube channel. 嗨,我是Beau,我運行了freeCodeCamp.org YouTube頻道 。 For the first few years of our channel’s life, we had less than 100,000 subscribers. When we published new videos, we …

【powerdesign】從mysql數據庫導出到powerdesign,生成數據字典

使用版本powerdesign16.5,mysql 5.5,windows 64 步驟: 1.下載mysql驅動【注意 32和64的驅動都下載下來,具體原因查看第三步 依舊會報錯處】 下載地址:https://dev.mysql.com/downloads/connector/odbc/5.3.html 請下…

php amazon-s3_推薦亞馬遜電影-一種協作方法

php amazon-s3Item-based collaborative and User-based collaborative approach for recommendation system with simple coding.推薦系統的基于項目的協作和基于用戶的協作方法,編碼簡單。 推薦系統概述 (Overview of Recommendation System) There are many met…

[高精度乘法]BZOJ 1754 [Usaco2005 qua]Bull Math

模板題目&#xff0c;練練手~ #include <iostream> #include <algorithm> #include <cstring> #include <cstdio> using namespace std;int s1[2333]; int s2[2333]; int Out[2333]; string one,two;void Debug(){for(int i0;i<one.length();i){pri…

python:使用Djangorestframework編寫post和get接口

1、安裝django pip install django 2、新建一個django工程 python manage.py startproject cainiao_monitor_api 3、新建一個app python manage.py startapp monitor 4、安裝DRF pip install djangorestframework 5、編寫視圖函數 views.py from rest_framework.views import A…

Kubernetes 入門(3)集群安裝

1. kubeadm簡介 kubeadm 是 Kubernetes 官方提供的一個 CLI 工具&#xff0c;可以很方便的搭建一套符合官方最佳實踐的最小化可用集群。當我們使用 kubeadm 搭建集群時&#xff0c;集群可以通過 K8S 的一致性測試&#xff0c;并且 kubeadm 還支持其他的集群生命周期功能&#…

Angular Material 攻略 04 Icon

Icon 網頁系統中的Icon雖然說很簡單&#xff0c;但是其中的學問還是有很多的&#xff0c;我們常用的Icon庫有FontAwesome、Iconfont等&#xff0c;我們選擇了Angular Material這個組件庫&#xff0c;就介紹Material Icons吧。 對Icon感興趣的同學可以看一下這里 Material Desig…

【9303】平面分割

Time Limit: 10 second Memory Limit: 2 MB 問題描述 同一平面內有n&#xff08;n≤500&#xff09;條直線&#xff0c;已知其中p&#xff08;p≥2&#xff09;條直線相交與同一點&#xff0c;則這n條直線最多能將平面分割成多少個不同的區域&#xff1f; Input 兩個整數n&am…

簡述yolo1-yolo3_使用YOLO框架進行對象檢測的綜合指南-第一部分

簡述yolo1-yolo3重點 (Top highlight)目錄&#xff1a; (Table Of Contents:) Introduction 介紹 Why YOLO? 為什么選擇YOLO&#xff1f; How does it work? 它是如何工作的&#xff1f; Intersection over Union (IoU) 聯合路口(IoU) Non-max suppression 非最大抑制 Networ…

django:資源網站匯總

Django REST framework官網 http://www.sinodocs.cn/ django中文網 https://www.django.cn/ 轉載于:https://www.cnblogs.com/gcgc/p/11542068.html

Kubernetes 入門(4)集群配置

1. 集群配置 報錯&#xff1a; message: ‘runtime network not ready: NetworkReadyfalse reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized’ 原因&#xff1a;cni未被初始化&#xff08;CNI 是 Container Network In…

【例9.8】合唱隊形

【例9.8】合唱隊形 鏈接&#xff1a;http://ybt.ssoier.cn:8088/problem_show.php?pid1264 時間限制: 1000 ms 內存限制: 65536 KB【題目描述】 N位同學站成一排&#xff0c;音樂老師要請其中的(N-K)位同學出列&#xff0c;使得剩下的K位同學排成合唱隊形。 合唱隊形是…

scrum流程 規劃 沖刺_Scrum –困難的部分2:更快地沖刺

scrum流程 規劃 沖刺In the first part, I presented my favorite list of Scrums hard parts and how to work around them. In the second part, I offer you a colorful bouquet of workarounds as well. Have fun!在第一部分中 &#xff0c;我介紹了我最喜歡的Scrum困難部分…

JAVA基礎知識|lambda與stream

lambda與stream是java8中比較重要兩個新特性&#xff0c;lambda表達式采用一種簡潔的語法定義代碼塊&#xff0c;允許我們將行為傳遞到函數中。之前我們想將行為傳遞到函數中&#xff0c;僅有的選擇是使用匿名內部類&#xff0c;現在我們可以使用lambda表達式替代匿名內部類。在…

數據庫:存儲過程_數據科學過程:摘要

數據庫:存儲過程Once you begin studying data science, you will hear something called ‘data science process’. This expression refers to a five stage process that usually data scientists perform when working on a project. In this post I will walk through ea…

901

901 轉載于:https://www.cnblogs.com/Forever77/p/11542129.html

leetcode 137. 只出現一次的數字 II(位運算)

給你一個整數數組 nums &#xff0c;除某個元素僅出現 一次 外&#xff0c;其余每個元素都恰出現 三次 。請你找出并返回那個只出現了一次的元素。 示例 1&#xff1a; 輸入&#xff1a;nums [2,2,3,2] 輸出&#xff1a;3 示例 2&#xff1a; 輸入&#xff1a;nums [0,1,0,…

【p081】ISBN號碼

Time Limit: 1 second Memory Limit: 50 MB 【問題描述】 每一本正式出版的圖書都有一個ISBN號碼與之對應&#xff0c;ISBN碼包括9位數字、1位識別碼和3位分隔符&#xff0c;其規定格式如“x-xxx-xxxxx-x”&#xff0c;其中符號“-”是分隔符&#xff08;鍵盤上的減號&#xff…

gitlab bash_如何編寫Bash一線式以克隆和管理GitHub和GitLab存儲庫

gitlab bashFew things are more satisfying to me than one elegant line of Bash that automates hours of tedious work. 沒有什么比讓Bash自動完成數小時繁瑣工作的Bash優雅系列令我滿意的了。 As part of some recent explorations into automatically re-creating my la…

寒假學習筆記(4)

2018.2.11 類中的常成員 關鍵字const&#xff0c;在類定義中聲明數據成員使用關鍵字限定&#xff0c;聲明時不能初始化。初始化列表&#xff0c;類中的任何函數都不能對常數據成員賦值&#xff0c;包括構造函數。為構造函數添加初始化列表是對常數據成員進行初始化的唯一途徑。…