Selecting All Items In a Listbox

  • Thread starter Thread starter Jonesgj
  • Start date Start date
J

Jonesgj

Chaps,

How would I select all items in a listbox using code?

I'm sure its an easy one but ....

Thanks
 
Jonesgj said:
How would I select all items in a listbox using code?

I'm sure its an easy one but ....


For i As Integer = 0 To Me.ListBox1.Items.Count - 1
Me.ListBox1.SetSelected(i, True)
Next
 
Hello,

Jonesgj said:
How would I select all items in a listbox using code?

Set the ListBox's 'SelectionMode' to 'MultiSimple' or 'MultiExtended', then
you can use this code:

\\\
Dim i As Integer
For i = 0 To Me.ListBox1.Items.Count - 1
Me.ListBox1.SetSelected(i, True)
Next i
///
 
Back
Top