I need to convert String to Int?

I have a text box in vb.net and I need the result to be converted into ‘int’ to store it in a Sql Server database. How can I do this?

Patrick from Maryland

One thought on “I need to convert String to Int?

  1. Hello Patrick,

    There are a couple of way to convert a string value into “int” in vb.net.

    int x = Int32.Parse(TextBox1.Text);

    Another way to convert is:
    int x = 0;

    Int32.TryParse(TextBoxD1.Text, out x);

    Int32.TryParse returns a boolvalue so you can use its return value to make a decision.
     

Comments are closed.