I have a DataGridView with a Button column in it.
I want to be able to disable and enable the buttons in every row (and/or change the style of them), according to a cell value in the row.
So let's say we have the following code :
if(dataGridView1.Rows[1].Cells[1].Value.ToString()=="OK")
{
//button in the same row should be enabled or disabled
}
Can this be done?
You can inherit a
DataGridViewDisableButtonCell
class fromDataGridViewButtonCell
to use in your DGV, as explained on MSDN. Then you'll be able to enable/disable the button inside that cell with the following code: