DataGridViewComboBoxCell value is not valid

DataGridViewComboBoxCell value is not valid

Old forum URL: forums.lhotka.net/forums/t/1310.aspx


Sarosh posted on Saturday, September 23, 2006

Hi!

Have a DataGridView with one of its columns (FK) defined as a DataGridViewComboBoxColumn. Its DataSource is set to a BindingSource whose DataSource is set to my BO which is based on Csla.NamedValueListBase.

When the form loads all the existing rows show up properly (including the ComboBox Column)  but as soon as I add a new row (BO.AddNew()) I get an error "DataGridViewComboBoxCell value is not valid".

If in my BO I set the default value of that FK column from 0 (which is the default) to some int which exists in that FK's base table then it works.

It looks like the ComboBox Column needs an int which already exists in the ComboBox's List if not it throws an error.

Sarosh

Copyright (c) Marimer LLC