private void button1_Click(object sender, EventArgs e)
 {
     if (totalWeight >= 100)
     {
         MessageBox.Show("Assessments exceed max weighting (100%), please edit or delete one.");
     }
     else
     {
         addAssessment addAssess = new addAssessment();
         addAssess.FormClosing += new FormClosingEventHandler(this.addAssessment_FormClosing);
         addAssess.Activate();
         addAssessment.totalWeight = totalWeight;
         addAssess.MD = this.MD;
         addAssess.ShowDialog();
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            md = new Module();

            if (checkbox20.Checked)
            {
                credits = 20;
            }
            else if (checkbox40.Checked)
            {
                credits = 40;
            }



            if (checkbox20.Checked && !moduleNameTxt.Text.Equals("") && !moduleCodeTxt.Text.Equals("") || checkbox40.Checked && !moduleNameTxt.Text.Equals("") && !moduleCodeTxt.Text.Equals(""))
            {
                exists = false;

                md.ModuleName = this.moduleNameTxt.Text;
                md.ModuleCode = this.moduleCodeTxt.Text;
                try
                {
                    for (int i = 0; i < moduleList.Count; i++)
                    {
                        if (moduleList[i].ModuleName.Equals(this.moduleNameTxt.Text) || moduleList[i].ModuleCode.Equals(this.moduleCodeTxt.Text))
                        {
                            exists = true;
                        }
                    }

                    if (exists)
                    {
                        System.Windows.Forms.MessageBox.Show("Module already exists, please change.");
                    }
                    else
                    {
                        previousCredits = maxCredits;
                        maxCredits      = maxCredits + credits;

                        if (maxCredits > 120)
                        {
                            MessageBox.Show("Exceeds Max Credits, Please change.");
                            maxCredits = previousCredits;
                        }
                        else
                        {
                            if (credits == 0)
                            {
                            }
                            else
                            {
                                md.ModuleCredits = credits;
                            }
                            addAssessment addAssessmentForm = new addAssessment();
                            addAssessmentForm.MD = this.MD;
                            this.Close();
                            addAssessmentForm.Activate();
                            addAssessmentForm.ShowDialog();
                            this.Dispose();
                        }
                    }
                }
                catch (NullReferenceException ERROR)
                {
                    Console.WriteLine(ERROR);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Please fill in all of the fields");
            }
        }