Hi,
I want to use a listbox with a vertical scroll and a horisontal scroll, but in the property, we can use only one or the other, so I need an alternate choice !
If anyone can help me ...
Thanks
Dom
try to use a combo box and set the width in design. The vertical scroll bar should auto show as you have the combo1.additem "Item".
I use it all of the time.
Something like the following should work: [tt]
Option Explicit
Private Declare Function SendMessage 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 AddAndModifyHScroll(lst As ListBox)
' depends on the scalewidth
' if scalemode is Twips then Divide MaxWidth by TwipsPerPixel to get pixels
Dim lp As Long
Dim MaxWidth As Long
For a = 0 To lst.ListCount - 1
If Me.TextWidth(lst.List(a)) > MaxWidth Then MaxWidth = Me.TextWidth(lst.List(a))
Next
SendMessage lst.hwnd, LB_SETHORIZONTALEXTENT, MaxWidth / Screen.TwipsPerPixelX, 0
End Sub
Thanks to everyone,
Finally, I use the Strongm solution which work perfectly after trying with richtextbox and msflexgrid without success.
Thanks for your help
Dom
Because I need to use the column function of the listbox, I need to make a V Scroll, because the HScroll is automatically made by the listbox when the columns property was not 0 so, if Strongm have an alternate choice to do it ... And I have some pb to use the columns property!
In fact, I want to use it like this :
list2.columns list1.listcount-1
I have tried with Set ... but that don't work, why ?
Thanks for your help
Dom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.