Example #1
0
        // ADD COURSE
        private void addButton_Click(object sender, EventArgs e)
        {
            // Create objects
            Online  myOnline  = new Online();
            InClass myInClass = new InClass();

            // Check which type of class the user input
            if (onlineRadioButton.Checked == true)
            {
                GetOnline(myOnline);
                courseList.Add(myOnline);

                // Display Data
                classesListBox.Items.Add(myOnline.Number + "\t" + myOnline.Name);
            }
            else
            {
                GetinClass(myInClass);
                courseList.Add(myInClass);
                // Display Data
                classesListBox.Items.Add(myInClass.Number + "\t" + myInClass.Name);
            }

            // Clear TextBoxes
            numberTextBox.Clear();
            nameTextBox.Clear();
            yearTextBox.Clear();
            semTextBox.Clear();
            desTextBox.Clear();
            teacherTextBox.Clear();
            classTextBox.Clear();
            hoursTextBox.Clear();
            examTextBox.Clear();
            teacherRoomTextBox.Clear();
            linkTextBox.Clear();
            passTextBox.Clear();
            ytTextBox.Clear();
        }
Example #2
0
        private void GetinClass(InClass inClass)
        {
            // Temp var to check type of input
            int tempInt;

            if (int.TryParse(yearTextBox.Text, out tempInt) &&
                int.TryParse(hoursTextBox.Text, out tempInt))
            {
                inClass.Year          = yearTextBox.Text;
                inClass.Hours         = hoursTextBox.Text;
                inClass.Number        = numberTextBox.Text;
                inClass.Name          = nameTextBox.Text;
                inClass.Semester      = semTextBox.Text;
                inClass.Description   = desTextBox.Text;
                inClass.Teacher       = teacherTextBox.Text;
                inClass.ClassRoom     = classTextBox.Text;
                inClass.Finals        = examTextBox.Text;
                inClass.TeacherOffice = teacherRoomTextBox.Text;
            }
            else
            {
                MessageBox.Show("You must enter integer values for YEAR and HOURS");
            }
        }