VARIABLES
-hold some value
-Assignment Statement- gives variable aa value
Variable=Value
ex. X=4
-Integer- positive or negative whole nuumber
-32000 to 32000
-Long- anything not in that range
-Single- short decimal
-Double-long decimal
-String- holds text, letters, symbols, and numbers
-Boolean- True or False
VARIABLE PREFIXES
Int=Integer
Lng=Long Sgl=single
Dbl=Double Str=String
Bln=Boolean
NAMING
VARIABLES
-need prefixes
-descriptive names
-Tell what you are doing with the variaable
DIMENSIONING VARIABLES
-tells computer about variable
Dimvariable As VariableTypeDimstrName
As String
StrName=&;Name&
DimintAge As Integer
IntAge=14
Operations
+ =Addition
- =Subtraction
* =Multiplication
/ =Division
^ =Exponents
-Integer division truncates decimal, reesults in integer.
20\7, 15\4, 50\6, 100\3
-Modular Division (mod) returns remaindder, resulting in integer.
20 mod 7, 15 mod 4, 50 mod 6, 100 mod 3
-Order of Operations
Exponents/Multiplication/Division/IntDivision/ModDivision/Addition/Subtraction
-In the properties box, name object.
ex. frmForm
-Change other properties in the code box
-With Statement allows you to change several properties at once.
ex. With lblLabel.caption="Hi"
.fontsize=10
.fontbold=True
End With
-To put pictures in program:
ex. imgPicture.Picture=LoadPicture("filepath"
CONSTANTS
-memory location which stores value. That value cannot be changed at run time
-Use Const instead of Dim when declaring variables
ex. Const variablename=constant value
SCOPE OF VARIABLE
-refers to the accessibility of variable or constant among procedures in program
Local Variables
-variables or constants declared in a sspecific procedure
-can only be used in the procedure in wwhich they are declared
Global Variables
-can be used in any procedure
-declared in (General) section and usess Private instead of Dim
-declare constants with Private Const/span>