//新增 private void U_btnAdd(object sender, EventArgs e) { Manager.Frm_userInfoAdd frm = new Manager.Frm_userInfoAdd(true, null); if (frm.ShowDialog() == DialogResult.OK) { LoadUserDataScoure(); } }
//更新 private void U_btnUpdate(object sender, EventArgs e) { int amount = u_DataList.SelectedRows.Count; if (amount == 1) { //获取你所选行的id string id = u_DataList.SelectedRows[0].Cells["ul_id"].Value.ToString(); Manager.Frm_userInfoAdd frm = new Manager.Frm_userInfoAdd(false, id); if (frm.ShowDialog() == DialogResult.OK) { LoadUserDataScoure(); } } else { MessageBox.Show("请先选择一条要修改的数据!", "尚未选择数据", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }