简体   繁体   English

如何从后面的代码检查 CheckedListBox 中的项目

[英]How to check an item in an CheckedListBox from code behind

I have a CheckedListBox that contains 3 values which are added manually and not from code behind.我有一个 CheckedListBox 包含 3 个值,这些值是手动添加的,而不是来自后面的代码。

This is how the CheckedListBox looks like:这就是 CheckedListBox 的样子:

在此处输入图像描述

I would like to add that these values are always the same in the same order, they never change.我想补充一点,这些值始终以相同的顺序相同,它们永远不会改变。

This is my question:这是我的问题:

  • Is possible to access these values from code behind so I can check them?是否可以从后面的代码中访问这些值以便我可以检查它们?

CheckedListBox in winforms has various properties - Items , CheckedItems , CheckedIndices for maniuplating it from the C# side. Winforms 中的CheckedListBox具有各种属性 - ItemsCheckedItemsCheckedIndices用于从 C# 端对其进行操作。

You can check them by calling SetItemChecked .您可以通过调用SetItemChecked来检查它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM