I have a datagridview in which one column contains a custom class, which I have set using:
dgvPeriods.Columns[1].ValueType = typeof(ExDateTime);
It is rigged up to display correctly by handling the CellFormatting event, but I'm unsure what event to handle for cell editing. In the absence of doing anything I get a FormatException as the datagridview tries to convert String to ExDateTime as I try to move focus out of the edited cell. I tried adding type conversion to my ExDateTime custom class:
public static implicit operator ExDateTime(string b)
{
return new ExDateTime(b);
}
But this this didn't work. I also tried handling the DataError event, but this seems to fire too late. The datagridview is not databound.