private void BtnStart_Click(object sender, EventArgs e) { frmMain NewWindow; if (rad3Min.Checked == true) { NewWindow = new frmMain(3); } else if (rad10Min.Checked == true) { NewWindow = new frmMain(10); } else { int time; if (!String.IsNullOrWhiteSpace(txtOther.Text) && int.TryParse(txtOther.Text, out time) && time < 100) { NewWindow = new frmMain(time); } else { MessageBox.Show("Time entered must be an integer less than 100."); return; } } //make this form invisible while the new window opens, make it visible again when new window closes this.Visible = false; NewWindow.ShowDialog(); NewWindow.Dispose(); this.Visible = true; }
private void btnStart_Click(object sender, EventArgs e) { //makes a new game window based on the time limit chosen frmMain NewWindow; if (rad3Min.Checked) { NewWindow = new frmMain(3); } else { NewWindow = new frmMain(10); } //make this form invisible while the new window opens, make it visible again when new window closes this.Visible = false; NewWindow.ShowDialog(); NewWindow.Dispose(); this.Visible = true; }