【问题标题】:Get string of item from checkboxlist从复选框列表中获取项目字符串
【发布时间】:2013-03-09 15:09:40
【问题描述】:
我想做这样的事情。
String s = "";
foreach (var item in checkedListBox1.Items)
{
s = checkedListBox1.Items(item).tostring;
// do something with the string
}
我想要列表框中项目的string。
我怎样才能让它运行起来?
【问题讨论】:
标签:
c#
winforms
checkboxlist
【解决方案1】:
我还没有尝试过,但我认为这应该可以。
string s = "";
foreach (var item in checkedListBox1.Items)
{
s = item.ToString();
// do something with the string
}
【解决方案2】:
string s = "";
foreach (string item in checkedListBox1.Items)
{
s = item;
// do something with the string
}
【解决方案3】:
我相信您正在寻找的是:
foreach (var item in checkedListBox1.Items)
{
checkedListBox1.GetItemText(item);
}
可能不是最有用的,但here is the MSDN 对它有用。