'Declare the global variables here.
CB1index = -1
Sub ComboBox1_SelectionChanged(I, v)
CB1index = ComboBox1.SelectedIndex
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)
' the useR is trying to type into the empty combobox - don't let him!
ComboBox1.Text = ""
Everyone should remember that the combobox has a different behaviour on the desktop and on the device.
- on the desktop, you are able to write free text into a combobox so that the selectedIndex returns -1
- on the device, it is not possible to "edit" the combobox
This seems to be a difference between .Net and .Net CF.