RESOLUTION
To resolve this problem, set the
SelectedIndex property to
-1 before you set the
Text property for a data-bound member of the
ComboBox, as in the following examples.
Visual Basic .NET
ComboBox1.SelectedIndex = -1
ComboBox1.Text = "My Text"
Visual C# .NET
ComboBox1.SelectedIndex = -1;
ComboBox1.Text = "My Text";
NOTE: Do not use the
Text property to select a data-bound member of the
ComboBox. You must locate the item in the list that you want to show, and
then set the
SelectedIndex to the index of the item. You do not have to set the
Text property.
For example, if you bind the
DisplayMember property and the
ValueMember property of the
ComboBox to a list that contains the numbers 1 through 10, and you want
the ComboBox to display the number
5 in the text box and show
5 as selected in the list, you must set the
SelectedIndex property to
5.