private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { string module = senderGrid.Rows[e.RowIndex].Cells[0].Value.ToString(); xbCon.UnloadModule(module); RefreshModulesButton_Click(sender, null); } }