//get which form to display private void btnStart_Click(object sender, EventArgs e) { int index = cboGame.SelectedIndex; switch (index) { case 0: CrazyEightsForm CrazyEights = new CrazyEightsForm(); CrazyEights.Show(); break; case 1: SolitaireForm Solitaire = new SolitaireForm(); Solitaire.Show(); break; } }
/// <summary> /// When the button is clicked it opens up the game's form that was choosen. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedItem.ToString() == "Crazy Eights") { CrazyEightsForm form = new CrazyEightsForm(); form.form = this; this.Hide(); form.Text = comboBox1.SelectedItem.ToString(); form.ShowDialog(); } else { SolitaireForm form = new SolitaireForm(); form.form = this; this.Hide(); form.Text = comboBox1.SelectedItem.ToString(); form.ShowDialog(); } }