//新建 private void but_new_Click(object sender, EventArgs e) { txt = tb_ins.Text; HCSCM_instrument_manage_new hcsm = new HCSCM_instrument_manage_new(null, select_id, ins); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); Loaddata(select_id); if (dgv_01.Rows.Count > 0) { dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1]; } }
//修改 private void but_edit_Click(object sender, EventArgs e) { int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); SortedList slindata = new SortedList(); try { slindata.Add("ca_rfid", dgv_01.SelectedRows[0].Cells["ca_rfid"].Value); slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value); slindata.Add("sm_num", dgv_01.SelectedRows[0].Cells["sm_num"].Value); HCSCM_instrument_manage_new hcsm = new HCSCM_instrument_manage_new(slindata, null, ins); hcsm.ShowDialog(); Loaddata(select_id); if (dgv_01.Rows.Count > selectedIndex) { dgv_01.CurrentRow = dgv_01.Rows[selectedIndex]; } } catch { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("choicechange", EnumPromptMessage.warning, new string[] { "修改", "实体器械" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); Loaddata(select_id); } }