Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

textbox input to arrayList

c#

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 tim

tim

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 28 May 2016 - 09:32 PM

  Once I have checked for a number, how do I add this to an arraylist? Then with the next entry being (+,-,/,*) to call a calulation method.

 

  private void txtCalculation_KeyPress(object sender, KeyPressEventArgs e)
        {
            int input1;
            if ((e.KeyChar == (char)13) && (txtCalculation.Text == ""))
            {
                MessageBox.Show("Please enter a number");
                e.Handled = true;
            }
            else
            {
                e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
                input1 = int.Parse(txtCalculation.Text);
            }
            ArrayList theCalcs;
            theCalcs.Items.Add(input1.ToString);

        }