Article ID: 113329
Article Last Modified on 11/18/2003
Control Name Property New Value
----------------------------------------------------------
Label1 Caption Turn off Auto-Scrolling by
clicking in the list box
Label1 Visible False
Label2 Visible False
Command1 Caption Turn on Auto-Scroll
' Enter the following Declare statement on one, single line:
Declare Function SendMessage Lib "User" (ByVal hWnd As Integer,
ByVal wMsg As Integer, ByVal wparam As Integer,
ByVal lparam As Any) As Long
Dim tmp$
Dim autoselect_on As Integer
Sub Form_Load ()
list1.AddItem "test 1"
list1.AddItem "test 2"
list1.AddItem "test 3"
list1.AddItem "test 4"
list1.AddItem "test 5"
list1.AddItem "test 6"
list1.AddItem "test 7"
list1.AddItem "test 8"
list1.AddItem "test 9"
End Sub
Sub List1_Click ()
tmp$ = list1.List(list1.ListIndex)
label2.Caption = "You selected: " & list1.List(list1.ListIndex)
label2.Visible = True
End Sub
Sub Command1_Click ()
Const WM_LBUTTONDOWN = &H201
' Turn on auto-scrolling:
r% = SendMessage(list1.hWnd, WM_LBUTTONDOWN, 0&, 0&)
label1.Visible = True
End Sub
Sub List1_Click ()
Const WM_LBUTTONDOWN = &H201
tmp$ = list1.List(list1.ListIndex)
label2.Caption = "You selected: " & list1.List(list1.ListIndex)
label2.Visible = True
If Not autoselect_on Then
autoselect_on = True
r% = SendMessage(list1.hWnd, WM_LBUTTONDOWN, 0&, 0&)
Else
autoselect_on = False
End If
End Sub
Additional query words: 2.00 3.00
Keywords: KB113329