使用C#一键检查复选框列表中的所有复选框 [英] Check all checkboxes in checkboxlist with one click using c#

查看:79
本文介绍了使用C#一键检查复选框列表中的所有复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有一个按钮,一旦单击它,它将选择我的复选框中的所有复选框。我已经搜索了可能的答案,但是我总是看到asp.net和javascript的示例。我在c#中使用Windows窗体。

I want to have a button that once clicked, it will select all checkboxes in my checklistbox. I've search the possible answers but I always see examples for asp.net and javascript. I am using Windows form in c#. Thank you for any response.

推荐答案

for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
    checkedListBox1.SetItemChecked(i, true);
}

这篇关于使用C#一键检查复选框列表中的所有复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆