请问如何取得多选中的listBox当前选中的文本内容?
请问如何取得多选中的listBox当前选中的文本内容?
用ListBox2.SelectedItems都是选中第一项而已,请问各位大大???
__________________________________________________________________________
string s=string.Empty;
for (int i=0;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 __________________________________________________________________________ 原文链接:/vb/264032.html