Example #1
0
        //---- delete courses
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                int crsid = (int)comboBox1.SelectedItem;
                using (Online_Exame ent = new Online_Exame())
                {
                    ent.deleteCourse(crsid);
                    ent.SaveChanges();
                }
                MessageBox.Show("Deleted Successfully");
                Courses.Items.Clear();
                Instructors.Items.Clear();
                label7.Text = comboBox1.Text = comboBox3.Text = textBox1.Text = string.Empty;

                LoadCourses();
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Incorrect ID");
            }
        }