0

I have different kinds of cells in a single DataGridView column.

When the user clicks on the box it used to turn entirely black.

Now I am able to capture the Entered event from the EditingControlShowing event and set the backgroundColor to white.

private void ATextBoxHasBeenEntered(object sender, EventArgs e)
{
    ((TextBox)sender).BackColor = Color.White;
    ((TextBox)sender).TextAlign = HorizontalAlignment.Left;
    ((TextBox)sender).BorderStyle = System.Windows.Forms.BorderStyle.None;
}

But I still see this black box!

enter image description here

So I went crazy trying to grab every related object and setting it to white. I've tried setting the associated DataGridViewTextBox's background to white, removing the border from everything, etc.

Nothing works :(

I can't tell if this black box is the DataGridViewTextBox or the editing control. I can't tell what event changes the color either.

What can I do?

micahhoover
  • 2,101
  • 8
  • 33
  • 53
  • How do you make the cell black to begin with? That's not the default behavior. – LarsTech Mar 28 '14 at 21:53
  • Winforms in .NET 3.5 does it :( I think it's because I have different types of cells in the same column. – micahhoover Mar 31 '14 at 12:43
  • http://social.msdn.microsoft.com/Forums/en-US/d9bf784d-617d-4a35-8125-fe8f67987fa2/datagridview-cell-color-changes-to-black-when-editing?forum=winformsdatacontrols – micahhoover Mar 31 '14 at 13:10

0 Answers0