Quote:
Originally Posted by RandomCoder
I was under the impression that the combobox is read-only?
|
Yes but it is a bit messy as you can type into the ComboBox and doing so resets SelectedIndex.
However (he said with an appropriate flourish!) with my ControlEvents library
http://www.basic4ppc.com/forum/additional-libraries/934-controlevents-library.html and an undocumented Text property of the ComboBox
Code:
Sub Globals
'Declare the global variables here.
CB1index = -1
End Sub
Sub App_Start
Form1.Show
CbEvents.New1("ComboBox1")
End Sub
Sub ComboBox1_SelectionChanged(I, v)
CB1index = ComboBox1.SelectedIndex
End Sub
Sub CbEvents_TextChanged
If CB1Index >= 0 Then ' AND ComboBox1.SelectedIndex = -1 Then
' the user has typed into a selection and so unset SelectedIndex so reset it
ComboBox1.SelectedIndex = CB1index
ComboBox1.Text = ComboBox1.Item(ComboBox1.SelectedIndex)
Else
' the useR is trying to type into the empty combobox - don't let him!
ComboBox1.Text = ""
End If
End Sub