Visual Basic 2008 / Visual Basic .NET Tutorial #3 – Variables

This tutorial will help you understand what a Variable is, how to create a variable and how they could be used. I have explained it in depth for the new programmers that have never used a variable before. Variables are one of the most important parts of programming that you will ever learn, so remember the syntax! Key Terms: ————— Variables Dim As Integer String Value


  1. be used anywhere within the form public means the variable can be used anywhere within the project while private means it can only be used on the form in which it was declared dim means the variables private while public shared means the variables public

  2. when you declare a variable you decide whether is public or private, local or global, you give it a name and you decide on its data type for example
    dim hello as string = “hello”
    makes the variable private gives it the name hello and gives it the data type string meaning your working with words and depending on where you place the variable tells the compiler whether its local or global local means it can only be used in the same event/sub/function it was declared in and global means it can

  3. Nice tutorial.
    Concerning variables, could you also write like:

    Dim hello As String

    hello = “Hello”
    then put like, MessageBox.Show(hello)

    Or must we give the variable a value as we declare them?

  4. @RevitalMalkan
    That’s a little much to stomach on the first real tutorial. I’m going to be creating a further informational video on variables and why you would use an integer instead of a string.

  5. When displaying integers you should convert them to a string first (turn on options strict)

    so you should do it like so:

Leave a comment