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
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
Comments are closed.
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.