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 - Visual Basic Tutorial
From the course: Visual Basic Essential Training
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
-
-
-
-
-
-
-
-
-
Work with variables and constants4m 56s
-
(Locked)
Use the Code Explorer project1m 59s
-
(Locked)
Declare a variable6m 30s
-
(Locked)
Tips to make literals pop in the editor2m 34s
-
(Locked)
Work with custom and built-in constants3m 54s
-
(Locked)
Understand variable scope5m 42s
-
(Locked)
Understand numeric to numeric conversions5m 54s
-
(Locked)
Convert numeric values5m 43s
-
(Locked)
Convert and format numbers to string6m 39s
-
(Locked)
Convert and parse string to numbers5m 59s
-
(Locked)
Work with strings7m 11s
-
(Locked)
Work with dates and times9m 21s
-
(Locked)
Challenge: Strings, dates, and parsing52s
-
(Locked)
Solution: Strings, dates, and parsing2m 5s
-
-
-
-
-
-
-
-