Loop through a listbox and select a certain amount of items ?

  • Thread starter Thread starter VBShaper
  • Start date Start date
V

VBShaper

Guest
I would like to Loop through a listbox's items and select items from 0 to the input from a textbox, so if the textbox text was 10 the first 10 items in the listbox would be selected.

The following loops through the Listbox and selects every item.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For i As Integer = 0 To ListBox1.Items.Count - 1
ListBox1.SetSelected(i, True)
Next
ListBox1.SelectionMode = SelectionMode.MultiExtended
End Sub

Continue reading...
 

Similar threads

D
Replies
0
Views
141
Danny Macwan
D
E
Replies
0
Views
98
extream87
E
I
Replies
0
Views
154
Innovators World Wide
I
E
Replies
0
Views
68
extream87
E
Back
Top