Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Horizontal Scroll in List Box

Status
Not open for further replies.

vbkris

Programmer
Jan 20, 2003
5,994
IN
Is there any way to have a horizontal and vertical scroll in a list box control?
 
Once the data entered into the listbox is beyond the width/height of the listbox, the scrollbars will appear.
 
Only vertical scroll is displayed. Horiaontal scroll does not come. It simply cuts the text.
 
I'm running Excel '97 on NT and it works for me. I get both horizontal and vertical scrollbars.

I put this button on a form with a single list box with default properties.

Private Sub CommandButton1_Click()
InputValue = InputBox("Enter value", vbOKOnly)
ListBox1.AddItem InputValue
End Sub
 
Try entering a very big value like:
asdasdasdasdasdasdsadasdasdasdasdasdasdasdasdsadasdasdasdasd

width of listbox:500
 
vbkris

I've just discovered something!

I'd looked at this before and found that creating the listbox from the forms toolbar doesn't give a hscroll. Creating from the Control Toolbox will but it was still cutting off my string.

Based on your last post I've just tried again but set the column width to something daft (500!) This gave the desired effect of inserting a horizontal scrollbar!

RYMB

ColumnWidths doesn't appear to have a default value, even after adding items! Features galore!


;-) If a man says something and there are no women there to hear him, is he still wrong?
 
what do u mean by Cotrol Toolbox loomah? i have worked a workaround for it in the form of an activex control.
 
Control Toolbox is the Toolbar with all the controls on it such as List Boxes & Command Buttons etc. The same controls are available from the Forms toolbar but there are some subtle differences between the two. Control Toolbox is the newer and more controlable/flexible of the two sets of controls. It's the same as Toolbox in VB.

What I was saying above is that it sounds as if you used the forms toolbar to create your control (don't know how if your control is on a form!) If you use the listbox from the toolbox you can set the column width which should solve your problem. Achedemic now if you've built your own control!

This is what weekends are for!!
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top