在C#中使用CheckedListBox控件的选定值 [英] Using Selected value of CheckedListBox Control in C#
本文介绍了在C#中使用CheckedListBox控件的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个checkedListBox控件,我从数据库中填充了一些值。
当我检查任何项目时CheckedListBox控件,我需要Selected值。
下面是相同的代码,请支持...
Hi,
I have a checkedListBox Control,Where i have filled Some value from database.
When I checked any item of the CheckedListBox control, I need the Selected value.
Below is the code for the same, Please support...
List<object> fields = new List<object>();
foreach (object itemChecked in chklbSection.CheckedItems)
{
DataRowView drv = itemChecked as DataRowView;
fields.Add(itemChecked);
fields.ToString();
}
如何从List对象中获取Selected值
How can i get the Selected value from List object
推荐答案
您需要查看此教程 [ ^ ]特别专注于这一行:
You need to check this Tutorial[^] especially concentrate on this line:
this.Text = checkedListBox1.Items[selected].ToString();
也应该遵循:
如何从checkedlistbox中获取已检查项目的值 [ ^ ]
如果你想要Text和
SelectedItem.Text属性/>
Selecte dValue属性,如果你想要价值。
请参阅以下链接了解更多详情
http://www.w3schools.com/aspnet/showaspx.asp?filename=demo_checkboxlist [ ^ ]
You should use
SelectedItem.Text property if you want Text and
SelectedValue property if you want the Value.
Please see the below link for more details
http://www.w3schools.com/aspnet/showaspx.asp?filename=demo_checkboxlist[^]
这篇关于在C#中使用CheckedListBox控件的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文