private void Button_Click(object sender, RoutedEventArgs e)
        {
            CourseForm cf = new CourseForm();

            cf.Show();
            this.Close();
        }
        private void dg_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                // Trying to get to the course form to modify the data *************
                if (e.Key == Key.Enter)
                {
                    CourseForm fc = new CourseForm();

                    Course c2 = (Course)dg.CurrentItem;

                    fc.txtId.Text       = c2.Id.ToString();
                    fc.txtDep.Text      = c2.Department;
                    fc.txtName.Text     = c2.CourseName;
                    fc.txtNumber.Text   = c2.CourseNumber.ToString();
                    fc.txtDesc.Text     = c2.Description;
                    fc.txtPre.Text      = c2.Prerequisite;
                    fc.txtInst.Text     = c2.Inst.FirstName;
                    fc.txtInstLast.Text = c2.Inst.LastName;

                    fc.txtStatus.Text   = c2.Status.ToString();
                    fc.txtSize.Text     = c2.ClassSize.ToString();
                    fc.txtEnrolled.Text = c2.Enrolled.ToString();
                    fc.txtSem.Text      = c2.Semester.ToString();
                    fc.txtYear.Text     = c2.Year.ToString();

                    fc.txtSection.Text   = c2.Section.ToString();
                    fc.txtCredit.Text    = c2.Credit.ToString();
                    fc.cBox.Text         = c2.Days.ToString();
                    fc.txtTime.Text      = c2.Time.ToString();
                    fc.txtLoacation.Text = c2.Location.ToString();

                    fc.Show();
                    this.Close();
                }
            }
            catch (Exception err2)
            {
                MessageBox.Show(err2.Message);
            }
        }
        private void dg_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                //DataGrid dg = (DataGrid)sender;
                CourseForm fc = new CourseForm();

                //c2 holds the ilist from the selecteed items of the datagrid.
                Course c2 = (Course)dg.SelectedItem;

                fc.txtId.Text       = c2.Id.ToString();
                fc.txtDep.Text      = c2.Department;
                fc.txtName.Text     = c2.CourseName;
                fc.txtNumber.Text   = c2.CourseNumber.ToString();
                fc.txtDesc.Text     = c2.Description;
                fc.txtPre.Text      = c2.Prerequisite;
                fc.txtInst.Text     = c2.Inst.FirstName;
                fc.txtInstLast.Text = c2.Inst.LastName;

                fc.txtStatus.Text   = c2.Status.ToString();
                fc.txtSize.Text     = c2.ClassSize.ToString();
                fc.txtEnrolled.Text = c2.Enrolled.ToString();
                fc.txtSem.Text      = c2.Semester.ToString();
                fc.txtYear.Text     = c2.Year.ToString();

                fc.txtSection.Text   = c2.Section.ToString();
                fc.txtCredit.Text    = c2.Credit.ToString();
                fc.cBox.Text         = c2.Days.ToString();
                fc.txtTime.Text      = c2.Time.ToString();
                fc.txtLoacation.Text = c2.Location.ToString();

                fc.Show();
                this.Close();
            }
            catch (Exception err2)
            {
                MessageBox.Show(err2.Message);
            }
        }