private void btnDelete_Click(object sender, EventArgs e) { try { if (dgvProgramList.Rows.Count > 0) { DialogResult dialogResult = MessageBox.Show("Session'u silmek istediğinize emin misiniz?", "Library Management System", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { int selectIndex = dgvProgramList.CurrentRow.Index; var sessionID = dgvProgramList.Rows[selectIndex].Cells[0].Value; SessionsHelper.Delete(Convert.ToInt32(sessionID)); MessageBox.Show("Session Silme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information); FillGrid(); } } } catch (Exception ex) { MessageBox.Show("Herhangi bir eleman seçmediniz!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }