DataGridView unbound column not updated.

Hi,

I'm binding to a set of data using the BindingSource control and a DataGridView. In the data I have various that contain enum values the need looking up for there text descriptions.

What I descided to do was to create an unbound column and respond to the CellFormatting event on the DGV; in the event, when the column index is my unbound column I lookup the enum value (as given from the datasource[Row]) and set e.Value (e being the event args). This does not update the cell, even though the value being set is correct. Move the mouse over the cell and it is fine.

If I remove the unbound column and display the bound enum value column but still respond to the CellFormatting event so I can format the bound column appropriately it all works. The grid is updated / repainted when the underlaying datasource is modified.

An I doing something wrong Is this a bug in an unbound column

Thanks

Graham


Answer this question

DataGridView unbound column not updated.

  • Josh0835

    For an unbound, handle the CellValueNeeded event and supply the value there.  You will also need to set the DataGridView.VirtualMode = true.
  • DataGridView unbound column not updated.