Safest Way to Convert String to an Integer in VB.net
Submitted by janobe on Tuesday, February 12, 2019 - 13:42.
In this tutorial, I will teach you how to convert String to an Integer in vb.net. This method is the safest way to do because it converts the specified string value to an equivalent 32bit signed integer. See the procedure below to see how it works.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.
Creating Application
Step 1
Open Microsoft Visual Studio 2015 and create a new windows form application for visual basic.
Step 2
Add two textboxes, two labels and button. After that, do the form just like shown below.
Step 3
Double click the button to fire the click event handler
of it and do the following codes for converting String to an Integer in the safest way.
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnConvert.Click
- txt_IntegerPrice.Text = Convert.ToInt32(Convert.ToDecimal(txt_StrPrice.Text))
- End Sub
Add new comment
- 584 views