From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Convert and parse string to numbers

Convert and parse string to numbers - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Convert and parse string to numbers

- [Instructor] The parse method is one of the best ways to turn string values into numeric values. It is part of the .NET classes, and you should know how to use it and TryParse. Having said that, it's also good to know that the default conversions, or implicit conversions available from VB will suffice in many situations. For this example, I have these two variables, and integer, and a double, I will set their values using the parse method on line 11, and then I'll output their values to the application, so right now it looks like this. I'm not parsing anything, so I've got a value of zero. Where I will get the information is from this text box, so the user can type in any value here, and then click on this Parse to Number and we should see the results. That text box is over here on the main window, it's here, and the name of that is InputTextBox. I can write code like this, go to the InputTextBox, get the text property,…

Contents