private void btnEdit_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection gv = this.dgDate.SelectedRows; if (gv.Count == 0) { MessageBox.Show("请选择记录?", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string id = gv[0].Cells[0].Value.ToString(); if (string.IsNullOrEmpty(id)) { MessageBox.Show("请选择记录?", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } FrmUserEdit edit = new FrmUserEdit(); edit.OpType = "edit"; edit.ID = id; edit.ShowDialog(); if (edit.IsReutrn) BindGridView(); }
private void btnUserAdd_Click(object sender, EventArgs e) { FrmUserEdit edit = new FrmUserEdit(); edit.Owner = this; edit.OpType = "add"; edit.ShowDialog(); if (edit.IsReutrn) BindGridView(); }