Results 1 to 4 of 4

Thread: horizontal scroll bar in a list box?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    33
    is it possible to add a horizontal scroll bar to my listbox, because sometimes the items in it get quite lengthly.

  2. #2
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    No friend, i don't think so it is possible to add a horizontal scroll bar to a list box.



    kinjal

  3. #3

  4. #4
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    In case you haven't found it, here's the code. (To run this example, put a listbox with the default name List1 on your form, then paste this code into the form.)

    Code:
    Option Explicit
    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 LB_SETHORIZONTALEXTENT = &H194
    
    Private Sub Form_Load()
       List1.AddItem "Line 1"
       List1.AddItem "a big Line 2 some text some text"
       List1.AddItem "line 2"
       List1.AddItem "Line 3"
       addHorScrlBarListBox List1
    End Sub
    
    
    Public Sub addHorScrlBarListBox(ByVal refControlListBox As Object)
       Dim nRet As Long
       Dim nNewWidth As Integer
       nNewWidth = 400 ' new width in pixels
       nRet = SendMessage(refControlListBox.hwnd, _
        LB_SETHORIZONTALEXTENT, nNewWidth, ByVal 0&)
    End Sub
    "It's cold gin time again ..."

    Check out my website here.

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