combobox view display width question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
Is there a way to have the view/display width different from the width as it
sits on the form?
 
OK, its not the combo control width that i want to set/change, its the width
of the dropdown text value field when someone clicks the combobox.
Example: the combo is width 50px but there are values that are 100px long,
What I want to do is when the user clicks the combo the drop down part is
wider than the combo control.

Brian
 
Change Dropdown width at runtime
Dim intLength As Integer = CInt(DataSet.Tables(0).Rows.Count)
Dim g As Graphics
g = ComboBox.CreateGraphics()
Dim x As Integer = 0
Dim maxWidth As Integer = 72
Do Until x = intLength
Dim w As Integer =
CInt(g.MeasureString(DataSet.Tables(0).Rows(x).Item(1).ToString,
ComboBox.Font).Width)
If (w > maxWidth) Then
maxWidth = w
End If
x = x + 1
Loop
g.Dispose()
ComboBox.DropDownWidth = maxWidth
 
BrianDH said:
Is there a way to have the view/display width different from the width as
it
sits on the form?

Check out the combobox' 'DropDownWidth' property.
 
Back
Top