[VB.NET]请问如何取得多选中的listBox当前选中的文本内容?

前端之家收集整理的这篇文章主要介绍了[VB.NET]请问如何取得多选中的listBox当前选中的文本内容?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

请问如何取得多选中的listBox当前选中的文本内容
请问如何取得多选中的listBox当前选中的文本内容

用ListBox2.SelectedItems都是选中第一项而已,请问各位大大???
__________________________________________________________________________
string s=string.Empty;
for (int i=0;i Box2.items.count;i++) if (this.ListBox2.Items[i].Selected) s+=this.ListBox2.Items[i].Text+ ","; __________________________________________________________________________ 这里是 VB.NET 论坛,不是 C# 论坛。 __________________________________________________________________________ ListBox2.SelectedItems(0)第一项 ListBox2.SelectedItems(1)第2项 ListBox2.SelectedItems(n)第n+1项 __________________________________________________________________________ 给你个例子,绑定代码是这样的 listBox1.DataSource = dt listBox1.DisplayMember = "title " listBox1.ValueMember = "id " 那么可以通过如下方式取得多行选中时的值 For Each row As DataRowView In listBox1.SelectedItems richTextBox1.Text += row( "id ") + vbCrLf richTextBox1.Text += row( "title ") + vbCrLf Next __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/264032.html

猜你在找的VB相关文章