private void but_update_Click(object sender, EventArgs e) { if (dgv_01.CurrentRow != null && dgv_01.SelectedRows != null && dgv_01.SelectedRows.Count > 0) { int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); SortedList slindata = new SortedList(); slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value.ToString()); slindata.Add("user_name", dgv_01.SelectedRows[0].Cells["user_name"].Value); slindata.Add("user_bcode", dgv_01.SelectedRows[0].Cells["user_bcode"].Value); slindata.Add("user_eid", dgv_01.SelectedRows[0].Cells["user_eid"].Value); slindata.Add("user_nick", dgv_01.SelectedRows[0].Cells["user_nick"].Value); slindata.Add("user_type", dgv_01.SelectedRows[0].Cells["user_type"].Value); slindata.Add("location_id", sl_location.GetKey(sl_location.IndexOfValue(dgv_01.SelectedRows[0].Cells["location_id"].Value))); slindata.Add("customer_id", dgv_01.SelectedRows[0].Cells["customer_id"].Value); slindata.Add("department_id", dgv_01.SelectedRows[0].Cells["department_id"].Value); slindata.Add("sex", dgv_01.SelectedRows[0].Cells["sex"].Value); slindata.Add("age", dgv_01.SelectedRows[0].Cells["age"].Value); slindata.Add("pic", dgv_01.SelectedRows[0].Cells["user_img"].Value); HCSSM_user_new hcsm = new HCSSM_user_new(slindata, sl_usertype); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.Text = ConfigurationManager.AppSettings["SystemName"].ToString() + "--修改用户"; hcsm.ShowDialog(); GetData(); if (dgv_01.Rows.Count > selectedIndex) { dgv_01.CurrentRow = dgv_01.Rows[selectedIndex]; } } else { MessageBox.Show("请选择一行数据", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void but_new_Click_1(object sender, EventArgs e) { HCSSM_user_new hcsm = new HCSSM_user_new(null, sl_usertype); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); GetData(); }