Ejemplo n.º 1
0
        /* METHOD -> DataBinds the Exam Combo Box */
        private void SetCbExams()
        {
            exams = ExamDB.GetExamByAdmin(adminID);

            if (exams.Count > 0) //Admin has exams, display and enable the exam name combo box
            {
                exams.Insert(0, new Exam {
                    ExamName = "Select Exam", ExamID = -1
                });                                                                 //instantiates placeholder object at index 0

                ctrl_cb_examName.DataSource    = exams;
                ctrl_cb_examName.DisplayMember = "ExamName";
                ctrl_cb_examName.ValueMember   = "ExamID";
                ctrl_cb_examName.Enabled       = true;
                ctrl_tb_duration.Text          = "";
            }
            else //Admin has no exams, disable Exam combo box
            {
                ctrl_cb_examName.DataSource = null;
                ctrl_cb_examName.Text       = "No Exams Created";
                ctrl_cb_examName.Enabled    = false;
                ctrl_btn_updateExam.Enabled = false;
                ctrl_btn_delete.Enabled     = false;
                ctrl_tb_duration.Text       = "";
            }
        }