/// <summary> /// 修改按钮触发事件 /// </summary> private void but_edit_Click(object sender, EventArgs e) { string change = string.Format(PromptMessageXmlHelper.Instance.GetPromptMessage("choicechange", EnumPromptMessage.warning), "修改的", "运输工具"); int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); SortedList slindata = new SortedList(); try { slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["id"].Value); slindata.Add("ca_name", dgv_01.SelectedRows[0].Cells["ca_name"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["ca_name"].Value); slindata.Add("bar_code", dgv_01.SelectedRows[0].Cells["bar_code"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["bar_code"].Value); slindata.Add("max_times", dgv_01.SelectedRows[0].Cells["max_times"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["max_times"].Value); slindata.Add("ca_type", dgv_01.SelectedRows[0].Cells["ca_type"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["ca_type"].Value); slindata.Add("ca_vender", dgv_01.SelectedRows[0].Cells["ca_vender"].Value == null ? string.Empty : sl_ProducerType.GetKey(sl_ProducerType.IndexOfValue(dgv_01.SelectedRows[0].Cells["ca_vender"].Value))); slindata.Add("sales_id", dgv_01.SelectedRows[0].Cells["sales_id"].Value == null ? string.Empty : sl_ProducerType2.GetKey(sl_ProducerType2.IndexOfValue(dgv_01.SelectedRows[0].Cells["sales_id"].Value))); slindata.Add("ca_remarks", dgv_01.SelectedRows[0].Cells["ca_remarks"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["ca_remarks"].Value); nud_max_times hcsm = new nud_max_times(slindata, getdt); hcsm.ShowDialog(); Loaddata(); 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); } }
private void but_new_Click_1(object sender, EventArgs e) { nud_max_times hcsm = new nud_max_times(null, getdt); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); Loaddata(); if (dgv_01.Rows.Count > 0) { dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1]; } }