/// <summary> /// 修改点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton2_Click(object sender, EventArgs e) { frmEditStuInfo fesInfo2 = new frmEditStuInfo(); //获取第一列也就是学生的编号 fesInfo2.StudentID = Convert.ToInt32(dgvStudent.CurrentRow.Cells[0].Value); fesInfo2.ShowDialog(); //重新绑定DataGridView this.FillStudentInfo(); }
/// <summary> /// 添加学生信息事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton1_Click(object sender, EventArgs e) { frmEditStuInfo fesInfo = new frmEditStuInfo(); //表示新增 fesInfo.StudentID = 0; fesInfo.ShowDialog(); //再次绑定dgvStuInfo this.FillStudentInfo(); }