C# 中 CheckListBox 的奇怪问题
我正在使用的应用程序中有很多复选框。因此,我决定改用 CheckedListBox。我使用下面的代码迭代列表...
private void CheckedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckedListBox1.CheckedItems.Count != 0)
{
string x = "";
for (int x = 0; x <= ServicesCheckedListBox3.CheckedItems.Count - 1; x++)
{
x = x + "Checked Item " + (x + 1).ToString() + " = " + ServicesCheckedListBox3.CheckedItems[x].ToString() + "\n";
}
Line.Add(x);
}
}
输出给了我这个...
System.Collections.Generic.List`1[System.String].
我很新,从未见过这个。该应用程序运行良好,但输出不正确。有什么建议吗?
I have quite a few check boxes in an application I'm playing with. So, I decided to use a CheckedListBox instead. I iterate through the list with the code below...
private void CheckedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckedListBox1.CheckedItems.Count != 0)
{
string x = "";
for (int x = 0; x <= ServicesCheckedListBox3.CheckedItems.Count - 1; x++)
{
x = x + "Checked Item " + (x + 1).ToString() + " = " + ServicesCheckedListBox3.CheckedItems[x].ToString() + "\n";
}
Line.Add(x);
}
}
The out put gives me this...
System.Collections.Generic.List`1[System.String].
I'm very new and have never seen this. The application runs fine but the out put doesn't come out right. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 foreach 迭代 CheckedItems
Use foreach to iterate through CheckedItems