DataGridView Exception: working with ComboBox
I have a datagrid on a windows form that I want to use the DataGridViewComboBoxColumn type. I set the binding properties as follows:
DataSource: tBQ_AttributeBindingSource
DisplayMember: Attribute_Name
ValueMember: Attirubute_Id (this is what I want to save back in the database for the particular record)
On the load of the form, I receive the following error:
"The following exception occured in the DataGridView:
System.FormatException: DataGridViewComboboxCell value is not valid
To replace this default dialog please handle the DataErro event"
I am totally stumped and need help debugging this problem.
Here is what I am trying to accomplish:
1. I have a table that has all of the valid "attribute names" i want to display in the combobox.
2. When the datagrid, loads, I read from another table of the actual attriburtes selected for the particular record (one record may have many attributes selected). So in the datagrid, I want to show a row for each attribute selected.
3. If a user chooses to add a new attribute, when the click the comboxbox column, I want the combobox to display ALL of the attributes names (from the table in item 1 above).
Thank you in advance!
Daniel