I have a DataGridViewComboBoxColumn that I allow the user to add new items to by typing in the ComboBox and hitting the 'Enter' key. That triggers CellValidating and I do the adding there by the following:


All this works well, except that it leaves the DataGridViewComboBoxColumn blank. How can I set the DataGridViewComboBoxColumn to display the e.FormattedValue?

I finally figured it out. Here's what I had to do:

Dim CBox As DataGridViewComboBoxCell = CType(dgvRecipe.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewComboBoxCell)

CBox.Value = e.FormattedValue
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.