I have this Database, not of my design but I have to work with it, that contains a table like so :
id | Name | status | ... -----+------------+-------
I wouldn't do it on CellFormatting. I would attack the DataTable itself. I would add a row that has the type of the enum, and the loop through the table and add the values. Something like this:
private void Transform(DataTable table)
{
table.Columns.Add("EnumValue", typeof(SomeEnum));
foreach (DataRow row in table.Rows)
{
int value = (int)row[1]; //int representation of enum
row[2] = (SomeEnum)value;
}
}
Then, in your DataGridView just hide the column that has the integer representation of your enum.