private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Point xy = dataGridView1.CurrentCellAddress; int x = xy.X; int y = xy.Y; if (x == 4) { List <string[]> res = bd.selectPuzzlesByComplexity(""); List <string> id_piece = new List <string>(); if (y < res.Count) { string id = res[y][0]; id_piece = bd.selectIdPiece(id); bd.deleteSaveByIdPuzzle(id); for (int i = 0; i < id_piece.Count; i++) { bd.deletePiecePuzzleByIdPuzzleAndOrIdPuzzle(id, id_piece[i]); } bd.deleteGameByIdPuzzle(id); bd.deletePuzzle(id); dataGridView1.Rows.RemoveAt(y); } } }