DiverDan
Well-known member
Im trying to limit a llist box to only two columns, then a vertical scroll bar if its necessary.
Im still getting a horizontal scroll bar???
Before I give up and use a listview, is there anyway to limit the listbox to only two columns, then display a vertical scrollbar?
Thanks
Dan
Code:
Dim itemAmount As Integer = LoadItems() + 1
Dim lstHeight As Integer
resize list box
If itemAmount > 10 Then
lstItems.MultiColumn = True
lstItems.HorizontalScrollbar = False
lstHeight = (Math.Ceiling(itemAmount / 2)) * 14
If lstHeight > 336 Then
lstItems.Height = 336
lstItems.ColumnWidth = (lstItems.Width / 2) - 16
Else
lstItems.Height = lstHeight
lstItems.ColumnWidth = (lstItems.Width / 2)
End If
Else : lstItems.Height = (itemAmount + 1) * 14
End If
resize form
124 pixels is used by the form
Me.Height = lstItems.Height + 124
Im still getting a horizontal scroll bar???
Before I give up and use a listview, is there anyway to limit the listbox to only two columns, then display a vertical scrollbar?
Thanks
Dan