From the course: Visual Basic Essential Training

Unlock the full course today

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

Convert numeric values

Convert numeric values - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Convert numeric values

- [Instructor] I'm looking at the code explorer application. Before we look at any of the code, click this Data type - Ranges button. What I've done is written some code that prints out the minimum and maximum allowed values for common Visual Basic data types. So I can look here and see that the maximum value allowed for Short is 32,767. So I can use that to analyze whether or not I can convert to a type. For instance, this UShort, the maximum value is 65,535. That will not fit in a Short. It's same with the Integer and the Long. Now it's obvious that the Long is too big to fit into the Integer. So this is a narrowing conversion to from Long to Int and a widening to go from Int to Long. Now close the application, switch over to Visual Basic and look at the code here in this RunCode3Button_Click handler. I won't go through all the code but I want you to see is that all of the dot net types, the numeric types, have…

Contents