private void NewYear(object sender, EventArgs e) { YearChooserForm yearForm = new YearChooserForm(); yearForm.FormClosing += new FormClosingEventHandler(this.RefreshOnClose); yearForm.Visible = true; }
private void OkayBtn(object sender, EventArgs e) { string name = this.nameField.Text; if (name.Length > 255) { MessageBox.Show("The club name is too long. Please enter a name less than 255 characters.", "TrotTrax Alert", MessageBoxButtons.OK); } else { DialogResult confirm = MessageBox.Show("Is \"" + name + "\" correct?", "TrotTrax Club Name Confirmation", MessageBoxButtons.YesNo); if (confirm == DialogResult.Yes) { string id = GetID(name); if (database.CheckClubExists(id)) { confirm = MessageBox.Show("The club \"" + name + "\" already exists. Do you wish to erase it and start over?", "TrotTrax Club Name Confirmation", MessageBoxButtons.YesNo); if (confirm == DialogResult.Yes) { database.AddClub(id, name); database.SetCurrentClub(id); YearChooserForm yearForm = new YearChooserForm(); yearForm.FormClosing += new FormClosingEventHandler(this.CloseOnClose); yearForm.Visible = true; this.Visible = false; } } else { database.AddClub(id, name); database.SetCurrentClub(id); YearChooserForm yearForm = new YearChooserForm(); yearForm.FormClosing += new FormClosingEventHandler(this.CloseOnClose); yearForm.Visible = true; this.Visible = false; } } } }