Example #1
0
        private void btnCourseAdd_Click(object sender, EventArgs e)
        {
            frmAddEditCourse addEditCourseForm = new frmAddEditCourse();

            addEditCourseForm.AddEdit    = CourseOperation.Add;
            addEditCourseForm.Id         = -1;
            addEditCourseForm.CourseName = "";
            addEditCourseForm.Level      = "";
            addEditCourseForm.ShowDialog();
            LoadCourseGrid();
        }
Example #2
0
 private void btnCourseEdit_Click(object sender, EventArgs e)
 {
     if (grdCourse.SelectedRows.Count > 0)
     {
         frmAddEditCourse addEditCourseForm = new frmAddEditCourse();
         addEditCourseForm.AddEdit    = CourseOperation.Edit;
         addEditCourseForm.Id         = Convert.ToInt32(grdCourse.Rows[grdCourse.SelectedRows[0].Index].Cells["Id"].Value);
         addEditCourseForm.CourseName = grdCourse.Rows[grdCourse.SelectedRows[0].Index].Cells["Course Name"].Value.ToString();
         addEditCourseForm.Level      = grdCourse.Rows[grdCourse.SelectedRows[0].Index].Cells["Level"].Value.ToString();
         addEditCourseForm.ShowDialog();
         LoadCourseGrid();
     }
     else
     {
         MessageBox.Show("You must select a course record to edit.", "Edit Course Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }