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.

Declare a variable

Declare a variable - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

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