From the course: Visual Basic Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Declare a variable - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Declare a variable
- [Instructor] Let's look at the syntax for declaring a variable, a local variable. To do that, I'll go to the code behind for this window, and I'll look in this RunCode sub. So there's four parts of a variable declaration. Some of these are optional, some of these are required. So, here is the full syntax. Dim is to declare a keyword. This means I'm working with a local variable. Then I have my identifier. Then I have my data type. And then, I have my initializer. Here, I'm doing the same thing, only I'm working with a Double. And when I run this application, I've written some code to analyze what's actually stored in there, so if I click on this Go button, you'll see that I say I have a variable called counter that is of type int32 that currently has a value of 22, and I've got a taxRate variable that has a type of Double that's 9.75. Now, let's talk about int32. This is the .NET type for the integer.…
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
-
-
-
-
-
-
-
-