ComboBox Data Binding and Case Sensitivity
Dave Juth, Senior System Architect
The ValueMember property of the Combo Box allows users to set
the binding column of the combo box. The .ValueMember property of a ComboBox
is case sensitive. If you mis-type the column name, or type the correct
column name with the wrong case for this property your code will throw an
"Could not bind to the new value member."
Without knowing that this is a likely cause of the exception, this can be
very difficult to track down.
An example: if the value column is named "EmployeeId" and you
use "EmployeeID," this will trigger the error:
comboBoxEmployee.DataSource = dtEmployee;
comboBoxEmployee.DisplayMember = "Name";
comboBoxEmployee.ValueMember = "EmployeeID";
Return to the tips page