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.
Work with custom and built-in constants - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Work with custom and built-in constants
- [Instructor] Now it's time to look at constants in your code. I'll be looking at the code here on line eight and nine where I declare two of my own custom constants. Now typically, when you create a constants, you usually declare them at the class level, like up here, or at the module level. For this demonstration, though, I'm keeping them as local constants. Line eight has the declaration. You start with the Const keyword, then the identifier, then your data type, and then you specify the initializer. You have to have an initializer, when you create a constant. On this line I'm initializing it with the numbers of Pi, on the second line on line nine, I'm creating a constants called HALF_BYTE and I'm initializing it with half the distance between zero and 256 for a byte. Let's talk about the data types. This is a decimal data type, it's the most accurate floating point type in Visual Basic. Very useful when you have data…
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
-
-
-
-
-
-
-
-