/// <summary> /// 修改学生成绩按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dgvStudentScore.RowCount == 0 || dgvStudentScore.CurrentRow == null) { MessageBox.Show("没有要修改的对象!", "修改提示"); return; } if (dgvStudentScore.CurrentRow == null) { MessageBox.Show("请选择要修改的对象!", "修改提示"); return; } //获取要修改课程信息 string StudentNameAndNumber = lvStudentName.Items[lvStudentName.FocusedItem.Index].Text.ToString(); string ClassName = combClassName.Text.Trim(); string Semester = combSemester.Text.Trim(); string CourseName = this.dgvStudentScore.CurrentRow.Cells["CourseName"].Value.ToString(); string Score_ = this.dgvStudentScore.CurrentRow.Cells["Score_"].Value.ToString(); Score objScore = objScoreService.GetStudentScoreForUpdate(StudentNameAndNumber, ClassName, Semester, CourseName, Score_); //显示修改窗体 FrmScoreUpdate objUpdateForm = new FrmScoreUpdate(objScore); DialogResult result = objUpdateForm.ShowDialog(); //判断是否修改成功 if (result == DialogResult.OK) { } }
//更改成绩信息 private void ToolStripMenuItemScoreUpdate_Click(object sender, EventArgs e) { FrmScoreUpdate add = new FrmScoreUpdate(); add.Show(dockPanel1); }