/// <summary> /// 修改当前学生信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (this.dgvStudentList.RowCount == 0 || this.dgvStudentList.CurrentRow == null) { MessageBox.Show("没有要修改的信息!", "打印提示"); return; } //获取要修改学生的学号 string StudentNumber = this.dgvStudentList.CurrentRow.Cells["StudentNumber"].Value.ToString(); Student objStudent = objStudentService.GetStudent(StudentNumber); //显示修改窗体 FrmStudentUpdate objUpdateForm = new FrmStudentUpdate(objStudent); DialogResult result = objUpdateForm.ShowDialog(); //判断是否修改成功 if (result == DialogResult.OK) { btnSearch_Click(null, null); } }
//更改学生信息 private void ToolStripMenuItemStuUpDate_Click(object sender, EventArgs e) { FrmStudentUpdate add = new FrmStudentUpdate(); add.Show(dockPanel1); }