|
-
Jun 13th, 2000, 06:31 AM
#1
Thread Starter
Lively Member
i can't figure out how to scroll a listbox(IN CODE!), hopefully there is a better way to than to setfocus on the last item
-
Jun 13th, 2000, 06:44 AM
#2
Well, there is a pretty stupid way i know. you can just send the {DOWN} key to your App. 
But i'm sure there's a better way that that.
-
Jun 13th, 2000, 06:54 AM
#3
Thread Starter
Lively Member
thanks, but i finally thought of a way(sadly kinda what i implied)
list1.ListIndex = list1.ListCount - 1
list1.ListIndex = -1
this moves it to the bottom yet doesn't highlight visiblely
thanks for trying, i just figured there was another, better way
oh, and i didn't know about the list1.listcount command
-
Jun 13th, 2000, 07:50 AM
#4
You could use the SendMessage API with the WM_VSCROLL Message, i.e.
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_VSCROLL = &H115
Private Const SB_LINEDOWN = 1
Private Const SB_LINEUP = 0
Private Const SB_PAGEDOWN = 3
Private Const SB_PAGEUP = 2
Private Const SB_TOP = 6
Private Const SB_BOTTOM = 7
Private Sub Command1_Click()
SendMessage List1.hwnd, WM_VSCROLL, SB_BOTTOM, ByVal 0&
End Sub
-
Jun 13th, 2000, 08:11 AM
#5
I usually use:
Code:
On Error Resume Next 'stops the error for when the listindex reaches the very bottom of the list
List1.listindex = List1.listindex + 1
That's all. 
-
Jun 13th, 2000, 08:49 AM
#6
Thread Starter
Lively Member
again thanks to everyone, but i am content with my code, short and very effective it seems to find the very bottom
(read above to see code)
-
Jun 13th, 2000, 09:07 AM
#7
Junior Member
I know I'm kinda late, but...
the TopIndex property is specifically meant for scrolling through a listbox in code.(The help file mentions that when it describes the function)
That way you don't have to do a work-around.
Hope that helped.
______
Bob K.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|