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(); if (bll.Delete(id)) { RemoveInfo remove = new RemoveInfo() { RId = Convert.ToInt32(id), RName = rows[0].Cells[1].Value.ToString(), RTable = "DishInfo" }; RemoveInfoBll removebll = new RemoveInfoBll(); removebll.Add(remove); LoadList(); } } else { MessageBox.Show("请选择一行数据"); } }
private void btnRemove_Click(object sender, EventArgs e) { if (dishInfoBll.Delete(Convert.ToInt32(dgvList.SelectedRows[0].Cells["Column1"].Value))) { MessageBox.Show("删除成功"); LoadList(); LoadTypeList(); } else { MessageBox.Show("删除失败"); } }
private void button_添加_删除选中的行数据_Click(object sender, EventArgs e) { var rows = dataGridView_菜单管理.SelectedCells; //MessageBox.Show(rows[0].Value.ToString()); DishInfo di = new DishInfo() { DId = Convert.ToInt32(rows[0].Value) }; if (dibll.Delete(di)) { GetInfo(); button_添加_取消.PerformClick(); } else { button_添加_取消.PerformClick(); MessageBox.Show("删除操作错误,请先选中要删除的行"); } }