Visual Basic
- uses a GUI (Graphical User Interface)
(user can interact w/ objects)
Object
- Form - place object on
- Label - allows you to put text on
form
Command
button - executes code when clicked.
*Event
Procedure - code executed when use
interacts w/program
Prefixes
- whatever you're naming, and object need to include.
- Form - frm
project
- Lable - lbl
word
- Command button - cmd
done
-
unload frm frmName
use ' (apostrophe)
- tell what the code is doing
'Ends Program
In property box, name object
"frmForm" - frmMusic
lblLabel
use descriptive names for object
ex.
Private Sub Form_Load ( )
lbl"name".caption="Hello
lbl.fontbold-"true"
frmForm.caption=""
With Statement - allows you to change several properties at once
Type: With ObjectName
Statement
End with
ex.
Private Sub Form_Load ( )
With lblLabel.caption="Hello"
.font size=10
.font bold = "true"
End With
Variables
- hold some value
Assignment
Statement
- gives a valuable a value
- valuable = value
x = 4
Integer
- positive or negative whole #
(-32,000 to 32,000)
Long
- big interger
Single
- short decimal
Double
- long decimal
String - holds text, letters,
symbols,#'s
Boolean - true or false
Var.
Prefixes
Interger = int
Long = lng
Single=sgl
Double=dbl
String=str
Boolean=bln
Naming
Valuables
1)Prefixes
2)Descriptive names
(tell what the valuable is doing)
Dimensioning
Valuables
-
tells computer info about valuable
Dim
ValuableName As ValuableType
Dim
strName As String
strName="NAME"
Dim
intAge As Interger
intAge=Age
Program
2 lables
place name in variable
Lable 2 = lbl Age
Place Age in variable
Image Box = imgPicture
Three command Buttons
1)Done
2)Display
3)CLEAR
Operations
+ addition
- subtraction
* multiplication
^ exponents
/ division
Integer
Division (\) - truncates (cuts off)
decimal, results in integer
20\7=2
50\6=8
15\4=3
100\3=33
Modular Division (mod)
= returns remainder resulting from division
20mod7=6
50mod6=2
15mod4=3
100 med3=1
Order of operation
Exponents/Mult/Div/Int Div/Mod Div/Add/Sub