DataGridViewComboBoxCell Binding - “value is not valid”

前端 未结 10 809
臣服心动
臣服心动 2020-11-30 09:45

I\'m trying to bind separate ComboBox cells within a DataGridView to a custom class, and keep getting an error

DataGridViewComboBoxCell value is not v

10条回答
  •  误落风尘
    2020-11-30 10:26

    use DataError Event handler,

    private void shahriartableDataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
            {
                //You don't have to write anything here !
            }
    

    and your DisplayMember and ValueMember data type should be the same, in my case I have CountryName for both. Everything works fine for me...!!

提交回复
热议问题