0
所以我想在vb.net 2010中有一个列表框的代码。Vb.Net 2010列表框
例如:
1) Apple
2) Pizza
3) Juice
如何将显示行号2或任何其他的用户 - 我试图与这样的标签盒做 Label1.Text = ListBox1.Text(2) - 不起作用。
所以我想在vb.net 2010中有一个列表框的代码。Vb.Net 2010列表框
例如:
1) Apple
2) Pizza
3) Juice
如何将显示行号2或任何其他的用户 - 我试图与这样的标签盒做 Label1.Text = ListBox1.Text(2) - 不起作用。
Label1.Text = ListBox1.Items(1).ToString()
,如果你想获得当前所选项目的文本,那么你可以做
If ListBox1.SelectedItem IsNot Nothing
Label1.Text = ListBox1.SelectedItem.ToString()
End If
MsgBox("List box item 1: " & ListBox1.Items(0), MsgBoxStyle.Information)
MsgBox("List box item 2: " & ListBox1.Items(1), MsgBoxStyle.Information)
MsgBox("List box item 3: " & ListBox1.Items(2), MsgBoxStyle.Information)