为1个项目设置名称复选框! [英] Set a name for 1 item checklistbox !

查看:120
本文介绍了为1个项目设置名称复选框!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个复选框:30个项目(1或0)
例如:0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
但我要每个项目的名称是1到30
1 2 3 4 .....

I have a checklistbox : 30 items ( 1 or 0)
ex : 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
but i want to each item will be name is 1 to 30
1 2 3 4.....
How can i change name of the item in checklistbox?

推荐答案

您不能在CheckedListBox项目上设置名称.

您可以使用项目的索引作为名称(索引+ 1).
You can''t set names on CheckedListBox items.

In your case you can use the index of the item as the name (index + 1 that is).


尝试以这种方式进行更改

try to Change in this way

for (int i = 0; i < CheckBoxList1.Items.Count; i++)
           {
               CheckBoxList1.Items[i].Text = Convert.ToString(i);
           }


这篇关于为1个项目设置名称复选框!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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