I am using a DataGridViewComboBox in a DataGridView. When a user selects a radio button, I would like to clear all the items in the DataGridViewComboBox and repopulate with new values. I do this as follows:
It appears to do the job, but later while the control is refreshing i get the error:Code:Dim iIndex As Integer Dim dgcb As DataGridViewComboBoxCell For iIndex = 0 To dgvRecipe.RowCount - 1 dgcb = dgvRecipe.Rows(iIndex).Cells("Measure") dgcb.Items.Clear() If radEnglish.Checked Then dgcb.Items.AddRange(New String() {"t", "T", "Cup", "Quart", "Gallon", "oz", "lbs"}) Else dgcb.Items.AddRange(New String() {"mg", "g", "ml", "Litre"}) End If Next iIndex
The following exception occured in the DataGridView:
System.ArguementException: DataGridViewComboBoxCell value is not valid.
To replace this default dialog please handle the DataError event.
Any ideas?




Reply With Quote