Hi,
ComboBox1.SelectedIndex=-1 does not mean clear the selected text.
You must clear the text of the selected item first.
As soon as you have filled a ComboBox and selected an item then ComboBox1.SelectedIndex=-1 gives an error.
ComboBox1.Clear does not clear the displayed text.
Because, generally, a default selection is made.
But why, after having initialized a combobox, not preselect the first item with ComboBox1.SelectedIndex=0 as the default, so the user has already one, and it avoids also your problem in a different way.
I have joined a modified code that solves your problem, and shows better the solution than the text.
For comparison, to show another way, I have replaced the
If Then
Else If
End If etc
by
Select
Case 0
Case 1
.
.
End Select
Best regards