Пример #1
0
        //--- update course
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                string crsname = textBox1.Text;

                int crsid = (int)comboBox1.SelectedItem;
                using (Online_Exame ent = new Online_Exame())
                {
                    ent.UpdateCourse(crsid, crsname);
                    ent.SaveChanges();
                }
                MessageBox.Show("Updated Successfully");
                Courses.Items.Clear();
                Instructors.Items.Clear();
                label7.Text = comboBox1.Text = comboBox3.Text = textBox1.Text = string.Empty;

                LoadCourses();
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Not complete Form");
            }
        }