private void btnRemove_Click(object sender, EventArgs e) { var rows = dgvList.SelectedRows; if (rows.Count > 0) { DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } string id = rows[0].Cells[0].Value.ToString(); MemberTypeInfoBll bll = new MemberTypeInfoBll(); if (bll.Delete(id)) { RemoveInfo remove = new RemoveInfo() { RId = Convert.ToInt32(id), RName = rows[0].Cells[1].Value.ToString(), RTable = "MemberTypeInfo" }; RemoveInfoBll removebll = new RemoveInfoBll(); removebll.Add(remove); LoadList(); } } else { MessageBox.Show("请选择一行数据"); } resulted = DialogResult.OK; }
private void btnRemove_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells["Column1"].Value); DialogResult result = MessageBox.Show("确定要删除嘛?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { if (MemberTypeInfoBll.Delete(id)) { LoadList(); UpdateList(); } else { MessageBox.Show("删除失败,请稍后重试"); } } }
private void btnRemove_Click(object sender, EventArgs e) { var row = dgvList.SelectedRows[0]; int id = Convert.ToInt32(row.Cells[0].Value); DialogResult result = MessageBox.Show("ays", "tis", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } if (bll.Delete(id)) { LoadDate(); } else { MessageBox.Show("删除失败"); } result = DialogResult.OK; }