i still use the API for this.
Public Class Form1
Private Declare Auto Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal _
hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As
Integer) As Long
Const LB_SETSEL As Long = &H185&
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
For i As Integer = 0 To 40000
ListBox1.Items.Add(i)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Call SendMessage(ListBox1.Handle, LB_SETSEL, True, -1)
End Sub
End Class
lance
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...
I've got a "Select all" button under a listbox. What's the most efficient
way to select all the items in the listbox?