Results 1 to 2 of 2

Thread: Listbox

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    Listbox

    Hey to all,

    I need to know if there is a way to add a horizontal scroll bar to a list box.

    Thanks in advance,

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Code:
          Option Explicit
    
          Private Declare Function SendMessageByNum Lib "user32" _
            Alias "SendMessageA" (ByVal hwnd As Long, ByVal _
            wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
          Const LB_SETHORIZONTALEXTENT = &H194
    
          Private Sub Command1_Click()
             Dim s As String
             Static x As Long
             s = InputBox("Please enter any text", "List scroll", _
               "this is a simple scrollbar sample for demonstration purposes")
             List1.AddItem s
             If x < TextWidth(s & "  ") Then
                x = TextWidth(s & "  ")
               If ScaleMode = vbTwips Then _
                   x = x / Screen.TwipsPerPixelX  ' if twips change to pixels
               SendMessageByNum List1.hwnd, LB_SETHORIZONTALEXTENT, x, 0
             End If
          End Sub
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

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