Thursday, April 21, 2011

DataGridViewButtonColumn change Button background Color

Hi , I construct a data grid by adding columns and rows.

DataGridViewButtonColumn dgtxc = new DataGridViewButtonColumn();
dgtxc.HeaderText = " stackoverflow";
dataGridView.Columns.Add(dgtxc);

After this i read the grid and if "something" then i want to change the background color of the Button in the grid . I do the following but only the line around the button changes.

if(dataGridView[r,c].value= "something")
{
     if(dataGridView[r,c].Style.BackColor = Color.Red;
}

How can i change the button color like this : button1.background = Color.Red

Thanks in advanced.

From stackoverflow
  • Maybe you can check out here

0 comments:

Post a Comment