Selecting all items in a Listbox???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Livvo is asking if I can get a multi-select listbox to select all items in
the box at the click on a button on the form.

Anybody know how to do this?

Ta
 
Private Sub CommandButton1_Click()
Dim i as integer
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
End Sub
 
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
End Sub
 
Brilliant, Ta.

Vergel Adriano said:
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top