You are on page 1of 13

Visual Basic Terms & Definitions, Part I

Visual Basic Window


Controls/objects you can position on your form to build your program.

Properties Window

Displays the properties (attributes) of the object currently selected in the form. Alphabetic or Categorized

Project Explorer Window

A tree-structured view of all the files inserted into the application. You can expand these and collapse branches of the views to get more or less detail.

Code Window

The Visual Basic window into which you type your program’s source code Basically, many lines of commands that tell the program what to do

Review Message Box
Private Sub Command1_Click() MsgBox “Visual Basic Rocks!” End Sub

Input/Output & Variables

Input/Output (I/O)
 Process

of moving data in and out of a computer.  Up to a program to control your computer’s input and output.  Example:
Private Sub Command1_Click() Form1.Print “Here’s some text output.” End Sub

Input/Output, cont.
Private Sub Command1_Click() Form1.Print “Here’s some text output.” End Sub

Print command creates a single line of text, in the form’s window. This text is called a string literal and must be enclosed in quotation marks. Form1 is telling Visual Basic where to look for the print command.

Input/Output, Printer
The example below shows the output change to the printer. The word “Printing…” will appear on the user’s screen, while the text will print to the printer.
Private Sub Command1_Click() Form1.Print “Printing…” Printer.Print “Here’s some text output.” Printer.EndDoc Form1.Cls End Sub

 Basically

memory boxes with names – you the programmer, supply the names.  For example, to keep track of the score in the game, you might have variable named score.

Whenever the player’s score changes, you can put the new score value into the variable named score.

Variables and Input
 Get

user input by using TextBox control.  Start new project – place a TextBox control and a CommandButton control on the form.  Enter for CommandButton in code window:
Private Sub Command1_Click() cars = Text1.Text Form1.Print “You have “ & cars & “ cars.” End Sub