0

I am attempting 2 separate ListBoxes for listing Offline and Online servers. The box refreshes every 3 seconds, and I need to be able to go through each item and get its text and index.

What can I do for this?

I've tried creating a For loop based on ListBox.Items but was unsuccessful.

4

2 回答 2

8

You would probably want to use something along these lines:

For l_index As Integer = 0 To MyListBox.Items.Count - 1
    Dim l_text As String = CStr(MyListBox.Items(l_index))
Next
于 2012-10-06T04:10:43.310 回答
0

Try this classic method:

     For i = 0 To ListBox1.Items.Count - 1
        ListBox1.SelectedIndex = i
        MsgBox("text: " & ListBox1.Text & "index: " & i)
    Next
于 2019-01-03T14:46:47.410 回答