示例#1
0
        /// <summary>
        /// 新建按钮触发事件
        /// </summary>
        private void but_new_Click(object sender, EventArgs e)
        {
            HCSCM_specialset_add HCSM = new HCSCM_specialset_add(null);

            HCSM.ShowDialog();
            Loaddate();
            if (dgv_01.Rows.Count > 0)
            {
                dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1];
            }
        }
示例#2
0
 /// <summary>
 /// "修改"按钮的触发事件
 /// </summary>
 private void but_edit_Click(object sender, EventArgs e)
 {
     if (dgv_01.SelectedRows.Count > 0)
     {
         int        selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]);
         SortedList sltmp         = new SortedList();
         sltmp.Add("name", dgv_01.SelectedRows[0].Cells["s_specialset"].Value.ToString());
         sltmp.Add("id", dgv_01.SelectedRows[0].Cells["idCol"].Value.ToString());
         sltmp.Add("customer", dgv_01.SelectedRows[0].Cells["s_customer"].Value.ToString());
         sltmp.Add("location", dgv_01.SelectedRows[0].Cells["s_location"].Value.ToString());
         sltmp.Add("costcenter", dgv_01.SelectedRows[0].Cells["s_costcenter"].Value.ToString());
         HCSCM_specialset_add hh = new HCSCM_specialset_add(sltmp);
         hh.ShowDialog();
         Loaddate();
         if (dgv_01.Rows.Count > selectedIndex)
         {
             dgv_01.CurrentRow = dgv_01.Rows[selectedIndex];
         }
     }
     else
     {
         MessageBox.Show("请选择一行数据。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }