Ejemplo n.º 1
0
        private void button_submit_Click(object sender, EventArgs e)
        {
            String name   = this.combo_name.SelectedItem.ToString();
            String month  = this.combo_month.SelectedItem.ToString();
            String number = this.combo_number.SelectedItem.ToString();
            String fruit  = this.combo_fruit.SelectedItem.ToString();

            int namenum   = name.Length + ((this.combo_name.SelectedIndex + 1) * 2);
            int monthnum  = month.Length + ((this.combo_month.SelectedIndex + 1) * 1);
            int numbernum = int.Parse(number) * 20;
            int fruitnum  = (this.combo_fruit.SelectedIndex + 1) * (fruit.Length * 100);

            if (Application.OpenForms.OfType <MagicForm>().Count() == 1)     //check if its already opened
            {
                Application.OpenForms.OfType <MagicForm>().First().Close();
            }

            MagicForm MF = new MagicForm(namenum + monthnum + numbernum + fruitnum);

            MF.Show();
        }