Input stirng was not in currect formate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vimal007
    New Member
    • Nov 2012
    • 1

    Input stirng was not in currect formate

    please help me.
    error is giving.



    Code:
    int ages = 0;
              ages = int.Parse(textBox2.Text);
               
                if(textBox2.Text == "")
                {
                    MessageBox.Show("Age Blank  ......");
                        
                }
                else if (ages >= 5 || ages <= 9)
                {
                    MessageBox.Show("age must be 5 to 9 only");
                }
    Last edited by Rabbit; Nov 19 '12, 01:41 AM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code.

    You haven't told us which line the error is on but I assume it's on line 2. That error means that what ever was typed into that textbox doesn't look like a number.

    Comment

    Working...