private void button6_Click(object sender, EventArgs e) { if (dataGridView1.SelectedCells[0].ColumnIndex == 0) { DbEngine.DeleteSelectedId(Convert.ToInt32(dataGridView1.SelectedCells[0].Value)); FillGrid(dataGridView1); } if (dataGridView1.SelectedCells[0].ColumnIndex == 1) { DbEngine.DeleteSelectedName((dataGridView1.SelectedCells[0].Value).ToString()); FillGrid(dataGridView1); } }