Пример #1
0
        //--- add course
        private void button1_Click(object sender, EventArgs e)
        {
            comboBox1.Text = string.Empty;
            try
            {
                using (Online_Exame ent = new Online_Exame())
                {
                    ent.InsertNewCourse(textBox1.Text);
                    ent.SaveChanges();

                    MessageBox.Show("Added Successfully");
                    Courses.Items.Clear();
                    Instructors.Items.Clear();
                    label7.Text = comboBox1.Text = comboBox3.Text = textBox1.Text = string.Empty;


                    LoadCourses();
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Please complete the information");
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Invalid Information");
            }
        }