private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { PreCheckHostRow preCheckHostRow = dataGridView1.Rows[e.RowIndex] as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.Enabled && e.ColumnIndex == 2) { ExecuteSolution(preCheckHostRow); } }