/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_die_Click(object sender, EventArgs e) { // create new dice object - pass seed to constructor aDie die; string str = textBox_seed.Text; int parse_test, seed; if (int.TryParse(str, out parse_test)) { seed = int.Parse(str); die = new aDie(seed); objects.Add(die); listBox_objects.Items.Add("Die"); } else if (String.IsNullOrEmpty(str)) { die = new aDie(); objects.Add(die); listBox_objects.Items.Add("Die"); } else { MessageBox.Show("Invalid seed. Enter an Integer or nothing at all."); textBox_seed.Text = ""; } }