private void btnStudentCourseAdd_Click(object sender, EventArgs e) { frmAddEditStudentCourse addEditStudentCourseForm = new frmAddEditStudentCourse(); addEditStudentCourseForm.AddEdit = StudentCourseOperation.Add; addEditStudentCourseForm.StudentCourseId = -1; addEditStudentCourseForm.StudentId = -1; addEditStudentCourseForm.CourseId = -1; addEditStudentCourseForm.Mark = "0"; addEditStudentCourseForm.ShowDialog(); LoadStudentCourseGrid(); }
private void btnStudentCourseEdit_Click(object sender, EventArgs e) { if (grdStudentCourse.SelectedRows.Count > 0) { frmAddEditStudentCourse addEditStudentCourseForm = new frmAddEditStudentCourse(); addEditStudentCourseForm.AddEdit = StudentCourseOperation.Edit; addEditStudentCourseForm.StudentCourseId = Convert.ToInt32(grdStudentCourse.Rows[grdStudentCourse.SelectedRows[0].Index].Cells["StudentCourseId"].Value); addEditStudentCourseForm.StudentId = Convert.ToInt32(grdStudentCourse.Rows[grdStudentCourse.SelectedRows[0].Index].Cells["StudentId"].Value); addEditStudentCourseForm.CourseId = Convert.ToInt32(grdStudentCourse.Rows[grdStudentCourse.SelectedRows[0].Index].Cells["CourseId"].Value); addEditStudentCourseForm.Mark = grdStudentCourse.Rows[grdStudentCourse.SelectedRows[0].Index].Cells["Mark"].Value.ToString(); addEditStudentCourseForm.ShowDialog(); LoadStudentCourseGrid(); } else { MessageBox.Show("You must select a student course record to edit.", "Edit Student Course Record", MessageBoxButtons.OK, MessageBoxIcon.Information); } }