tom linker

tom linker

  • NA
  • 87
  • 74.4k

Int32.parse method

Aug 27 2012 10:24 AM
private void button1_Click(object sender, EventArgs e)
        {          
            long i = Int64.Parse(textBox1.Text);
            MessageBox.Show(i.ToString());
        }
In This code, If we pass the textBox value in interger type, It's return integer value just like
textBox1.text=23 return 23.
But if we enter string type value in textBox, it's fire exception, as like
textBox1.text="Tom".

Why?

 

Answers (8)