From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Implicit covert strings to numbers

Implicit covert strings to numbers - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Implicit covert strings to numbers

- [Instructor] The TryParse method is one of the safest ways to turn string values into numeric values. It is part of the .NET classes and you should know how to use it. Having said that, it's also good to know that the default conversions available from Visual Basic will suffice in many situations. Let's look at implicit conversions. First, a note. I've changed the startup URI to ParseWindow. I'll be writing the code in this vb file, and what I want to do is take some user input from this control, which is called InputTextBox, and I want to attempt to convert that into an integer and a double. I'll start by taking myInteger and getting the text out of the TextBox. So this is an implicit conversion because this is a string and this is an integer. So copy this, and then I'll change this to my double. That's the basics of it. Then I'm going to show the integer value and then the double value. All right, let's run it. When I click on this button, it parses it like we expect. If I add…

Contents