I have a winforms application that uses a datagridview. When I access the EditedFormattedValue of a cell while it is in edit mode, sometimes, but not always, the whole cell turns black. Is this a feature of the datagridview, perhaps some sort of validation feature I need to turn off?
I have found a couple of other mentions of this problem while googling. None of the threads seem to know what the answer is either:
Here not calling Application.DoEvents solved the problem, but I am not calling DoEvents.
Here no one knew why it was happening, but responders suggest setting the background color to white. That seems like a hack, and I'd like to know why this is happening. Also, changing the background color doesn't remove the black background for me.
Well, though I haven't been able to figure out why this is happening with the
dataGridView1.CurrentCell.EditedFormattedValue, I found that using the
dataGridView1.EditingControl.Text value gets the same value and doesn't mess with the cell formatting. So, I guess that solves my problem.