Home » Controls » How to Quick Select/UnSelect all items in List Box
How to Quick Select/UnSelect all items in List Box
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 'Controls - How to Quick Select/UnSelect all items in List Box Option Explicit 'Add a List Box and two Command Buttons to your form and set List1 MultiSelect property to 1-Simple. Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Const LB_SETSEL = &H185& Private Sub Command1_Click() Call SendMessageLong(List1.hwnd, LB_SETSEL, True, -1) End Sub Private Sub Command2_Click() Call SendMessageLong(List1.hwnd, LB_SETSEL, False, -1) End Sub Sub Form_Load() Dim I As Integer, max As Integer max = Screen.FontCount If max > 15 Then max = 15 For I = 1 To max List1.AddItem Screen.Fonts(I) Next End Sub |
Enjoy this article?
Filed under: Controls
Leave a comment