VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Adding a Horizontal ScrollBar to a ListBox

by SoftwareMaker (2 Submissions)
Category: Coding Standards
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Just a simple code snippet that teaches users how to add that illusive Horizontal ScrollBar to a Listbox Control or any other control, for that matter.

Rate Adding a Horizontal ScrollBar to a ListBox

'Declaring the SendMessage API - To send a Message to other Windows
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const LB_SETHORIZONTALEXTENT = &H194
'Set the Horizontal Bar to 2 times its Width
Dim lngReturn As Long
Dim lngExtent As Long
 lngExtent = 2 * (Form1.List1.Width / Screen.TwipsPerPixelX)
 lngReturn = SendMessage(Form1.List1.hWnd, LB_SETHORIZONTALEXTENT, _
 lngExtent, 0&)

Download this snippet    Add to My Saved Code

Adding a Horizontal ScrollBar to a ListBox Comments

No comments have been posted about Adding a Horizontal ScrollBar to a ListBox. Why not be the first to post a comment about Adding a Horizontal ScrollBar to a ListBox.

Post your comment

Subject:
Message:
0/1000 characters