Topic outline

  • Console

    Simplest type of program is a console application which is limited to text input and output.

  • Declaring Variables

    Before we can use any variable in VB we must declare it to the program. This allows the computer to assign any space required to the variable and prepare it for use.

  • File IO

    Before long you will find many of your programs rely upon data which comes from or needs to be stored in a file – no longer are simple variables suffcient.

    Reading the contents of a file

    The following simple program will read the contents of a file and print it into a message alert box.

    Dim fileReader As String
    fileReader = My.Computer.FileSystem.ReadAllText("N:wolf.txt")
    MsgBox(fileReader)

    TBC

  • Functions and Subs

    Programming in a modular style is very useful:

    • It allows us to divide our problem into managable sized chunks.
    • We can test procedures in isolation to ensure they work as expected.
    • We can reuse them again and again.
    • Modular Code that is re-used only requires undating in one location regardless of how many times it is used.

    There are two types of procedure that can be used in VB

    • Subs – return nothing – they just DO!
    • Functions – return something – send back an answer!
  • Repetition

    Also know as Looping and Iteration

    Repeating sections of code is an essential part of procedural programming. The following examples show the three types of repetition avaliable in Visual Basic

  • Selection

    There are two ways in VB that you can make decisions in Visual Basic.

    • If Then Else Statements
    • Case Switch Statements
  • String Operations

    super powerful string operations that are so useful.