private void addModuleLvl6_Click(object sender, EventArgs e) { totalCredits = 0; for (int i = 0; i < moduleListlvl6.Count; i++) { totalCredits = totalCredits + moduleListlvl6[i].ModuleCredits; } if (totalCredits >= 120) { MessageBox.Show("Credit limit reached, please delete a module to continue"); } else { if (moduleListlvl6.Count >= 5) { MessageBox.Show("Module limit of 5 exceeded, please delete a module to continue."); } else { level4 = false; level5 = false; level6 = true; am = new AddModule(moduleList, totalCredits); am.FormClosing += new FormClosingEventHandler(this.AddModule_FormClosing); am.Activate(); am.ShowDialog(); } } }
private void button5_Click(object sender, EventArgs e) { totalCredits = 0; try { for (int i = 0; i < moduleListlvl4.Count; i++) { totalCredits = totalCredits + moduleListlvl4[i].ModuleCredits; } if (totalCredits >= 120) { MessageBox.Show("Credit limit reached, please delete a module to continue"); } else { if (moduleListlvl4.Count >= 7) { MessageBox.Show("Module limit of 7 exceeded, please delete a module to continue."); } else { level5 = false; level6 = false; level4 = true; am = new AddModule(moduleList, totalCredits); am.FormClosing += new FormClosingEventHandler(this.AddModule_FormClosing); am.Activate(); am.ShowDialog(); } } } catch (NullReferenceException exception) { } }