private void BtnAdd_Click(object sender, EventArgs e) //event for add button being clicked { frmAddScore newScore = new frmAddScore(); // declare new instace of frmAddScore newScore.Show(); //show new form newScore.VisibleChanged += addformVisibleChanged; //change visibility to form update score }
private void addformVisibleChanged(object sender, EventArgs e) // Method for with the AddScore Form closes { frmAddScore addscore = (frmAddScore)sender; //declare new instance of frmAddScore if (!addscore.Visible & addscore.DoAdd()) //if form is visible and do add is true { updatedList.Add(addscore.newScore); //update the list with new score frmAddScore FillListBoxScores(); //call fill list box score method addscore.Dispose(); //dispose of the form this.Show(); } }