private void btnDelete_Click(object sender, EventArgs e) { try { using (var transdao = new TransactionDAO()) { if (dgvData.SelectedRows != null) { DataGridViewRow row = dgvData.CurrentRow; foreach (var item in listAwal) { if (item.SubCategory.ToString() == row.Cells[1].Value.ToString() && item.Amount.ToString() == row.Cells[2].Value.ToString() && item.Note.ToString() == row.Cells[3].Value.ToString()) { DialogResult = MessageBox.Show("Are you sure you want to delete this transaction ?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult == DialogResult.Yes) { transdao.Delete(item); } break; } } } } FrmDetailTransaksi_Load(null, null); } catch (Exception ex) { throw ex; } }