//删除操作 private void button3_Click(object sender, EventArgs e) { var row1 = dataGridView1.SelectedRows; if (row1.Count > 0) { DialogResult result = MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { int id = Convert.ToInt32(row1[0].Cells[0].Value); if (hiBll.Remove(id)) { LoadList(); RefreshHallEvent(); } else { MessageBox.Show("删除失败,请稍后重试!!!"); } } } else { MessageBox.Show("请选中这一行!!!"); } }
private void btnRemove_Click(object sender, EventArgs e) { //获取选中的行 var rows = gvHallInfo.SelectedRows; if (rows.Count > 0) { DialogResult result = MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { int id = int.Parse(rows[0].Cells[0].Value.ToString()); if (hiBll.Remove(id)) { LoadHallInfoList(); UpdateHallInfoEvent(); } else { MessageBox.Show("删除失败,请稍后重试!"); } } } else { MessageBox.Show("二货,你还没选要删除的行呢!"); } }
private void btnRemove_Click(object sender, EventArgs e) { int index = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); DialogResult result = MessageBox.Show("确认要删除吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { if (bll.Remove(index)) { MessageBox.Show("删除成功!"); } else { MessageBox.Show("删除失败!请稍后重试"); } } else { } txtId.Text = "添加时无编号"; txtTitle.Text = ""; LoadList(); UpdateForm(); }
private void btnRemove_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); DialogResult result = MessageBox.Show("Delete?", "Alert", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } if (hiBll.Remove(id)) { LoadList(); } }
private void btnDelete_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } if (hiBll.Remove(id)) { LoadList(); } //调用自定义事件,事件中的方法都会被执行 MyUpdateForm(); }
private void btnRemove_Click(object sender, EventArgs e) { var row = gv_HallInfoList.SelectedRows; if (row.Count > 0) { if (_hiBll.Remove(Convert.ToInt32(row[0].Cells[0].Value))) { UpdateHallEvent?.Invoke(); LoadList(); } else { MessageBox.Show("删除失败"); } } }
private void btnRemove_Click(object sender, EventArgs e) { int Hid = Convert.ToInt32(dgvList.SelectedCells[0].Value); DialogResult result = MessageBox.Show("确定要删除此条记录吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } if (hiBll.Remove(Hid)) { LoadList(); } else { MessageBox.Show("删除失败"); } updateInfo(); }
//逻辑删除按钮 private void btnRemove_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dgvList.SelectedCells[0].Value); DialogResult result = MessageBox.Show("确认要删除吗?", "提示", MessageBoxButtons.OKCancel); if (result != DialogResult.OK) { return; } if (hiBll.Remove(id)) { LoadList(); Clean(); MessageBox.Show("删除成功."); } else { MessageBox.Show("删除失败,请稍后重试......"); } MyUpdateForm(); }
private void btnRemove_Click(object sender, EventArgs e) { //提示确认是否删除 DialogResult result = MessageBox.Show("确定要删除?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } //获取用户选中的id int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); //调用方法软删除 if (hiBll.Remove(id)) { LoadList(); } else { MessageBox.Show("删除失败,请稍候重试"); } //刷新事件 RefreshList(); }