We help IT Professionals succeed at work.

Click Button Add to Value

tbaseflug
tbaseflug asked
on
Medium Priority
223 Views
Last Modified: 2010-05-18
I have a textbox and a button on a mobile app - what I need to do, is each time the button is click increment the numeric value, in the textbox by 1.
Comment
Watch Question

CERTIFIED EXPERT
Commented:
private void button1_Click(object sender, System.EventArgs e)
            {
                  int i = 0;
                  
                  i = Convert.ToInt16(textBox1.Text);
                  i +=1;
                  textBox1.Text = i.ToString();
            }

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Or:

       private void button1_Click(object sender, System.EventArgs e)
       {
          this.textBox1.Text = (Convert.ToInt32(this.textBox1.Text) + 1).ToString();
       }

Bob
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.