				ComboBoxLB

Last changed at 26-November-2001.

Version 2.10



This control is created by Patrick van Olderen.
http://www.home.zonnet.nl/PatrickO/



Changes made:

============================================================

Properties:

============================================================

Public Property Get ArrayWithItems() As Variant

You can now determine the width of the longest item in a column
and set the columnwidth accordingly.

' this example is for a combobox with two columns
   Dim varArray As Variant
   Dim lngItemsInArray As Long
   Dim lngI As Long
   Dim intTextWidth As Integer, intMaxWidth As Integer
      
   varArray = ComboBoxLB1.ArrayWithItems
   
   lngItemsInArray = ComboBoxLB1.ListCount
   intMaxWidth = 0
   
   ' determine the width of first column
   For lngI = 0 To lngItemsInArray - 1
      intTextWidth = TextWidth(varArray(0, lngI))
      If intTextWidth > intMaxWidth Then
         intMaxWidth = intTextWidth
      End If
   Next lngI
   
   intMaxWidth = intMaxWidth + 45    ' increase 45, this is the left offset in listbox
   ComboBoxLB1.ColumnWidths = intMaxWidth & ";800"    ' set the new width of first column, last colum is 800
   ComboBoxLB1.ListWidth = intMaxWidth + 800    ' set the new listwidth



This control is created by Patrick van Olderen.
http://www.home.zonnet.nl/PatrickO/



Using this control is for your own risk. I do not take any responsibility for harm done using this control.