Пример #1
0
        private void toolStrip_edit_Click(object sender, EventArgs e)
        {
            //打开编辑
            if (dataGridView1.SelectedRows.Count == 1)
            {
                string    selectrow = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString();
                Form_Edit formedit  = new Form_Edit();
                formedit.studentid_edit = selectrow;
                formedit.ShowDialog();
                if (treeView1.SelectedNode != null)
                {
                    StudentInfo Rchose = new StudentInfo();

                    switch (treeView1.SelectedNode.Tag.ToString())
                    {
                    //通过调用search中现有的方法完成
                    case "0": dataGridView1.DataSource = StudentInfoBLL.GetAllStudentInfo(); break;

                    case "1":
                        Rchose.Profession        = treeView1.SelectedNode.Text;
                        dataGridView1.DataSource = StudentInfoBLL.GetStudentInfoList(Rchose);
                        break;
                        //使用Tag标志区别选中的标签类别,可以再次扩展,这里不做了,用Tag意义不大
                    }
                }
                else
                {
                    initContracts();
                }
            }
            else
            {
                MessageBox.Show("请选中一行后再点击编辑按钮");
            }
        }
Пример #2
0
 private void toolStript_edit_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 1)
     {
         int       selectrow = Int32.Parse(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString());
         Form_Edit formedit  = new Form_Edit();
         formedit.studentid_edit = selectrow;
         formedit.ShowDialog();
         initContracts();
     }
     else
     {
         MessageBox.Show("请选中一行后再点击编辑按钮!");
     }
 }