Results 1 to 3 of 3

Thread: Scroll Bars in ListBox Control !

  1. #1
    ashky
    Guest

    Question Scroll Bars in ListBox Control !

    Hai,

    How can i set both vertical and horizontal scroll bars in a listbox control.

    There isn't any property during design time. However the horizontal scroll bars works as the number of items increases but not the vertical scroll bar.

    Any idea / code highly appreciated ...,

    ashky.

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Use the SendMessage API call with the LB_SETHORIZONTALEXTENT constant, ie......

    VB Code:
    1. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    2.             ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    3.  
    4. Private Const LB_SETHORIZONTALEXTENT = &H194
    5.  
    6. Public Sub AllowHorizScroll(pList As ListBox, pTwips As Integer)
    7. Dim iPix As Integer
    8.    
    9.     iPix = pTwips \ Screen.TwipsPerPixelX
    10.    
    11.     SendMessage pList.hwnd, LB_SETHORIZONTALEXTENT, iPix, &O0
    12.  
    13. End Sub
    14.  
    15. Private Sub Form_Load()
    16.  AllowHorizScroll List1, List1.Width + 1000
    17. End Sub
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    ashky
    Guest

    Thanks

    Dear YoungBuck,

    Thank you very much for ur reply. It worked perfectly.

    ashky.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width