Symptoms
If you programmatically set the Text property for a data-bound member of the ComboBox control, the value typed in the text box portion of the ComboBox is displayed as expected. However, the Text property and the SelectedIndex property incorrectly return the value of the last item that was selected in the list box instead of returning the value typed in the text box.
When you type in the ComboBox at runtime, Text property returns the typed value, and SelectedIndex returns a value of -1.
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 = -1ComboBox1.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.