VB-1 Concepts
CIS241 - Fall 2001
v Control
Constructs
X If-Then
& If-Then-Else
VB is line
oriented
Demarcation via
If, Then, Else, End If
X While-Wend
Continuation
Test; PreTest
X Do-Until
Termination
Test; PostTest
Word Loop is required
X For-Next
Loop control
variable (LCV, loop counter)
Can specify
increment (or decrement) with Step
Non-integer
values allowed for loop counter
X Select-Case
Concepts:
ruling value expression, selection expression
Case Else allowed
Keywords: To, Is, End Select
v Subroutines
X Event Procedures
Name = <object>_<event>
Template & parameters produced by
IDE
Invoked by
occurrence of<event> with respect to <object>
Code supplied
by user
X General Procedures
Demarcation
via Public/Private
Sub, End Sub
X Functions
Demarcation
via Public/Private
Function, End Function
Value returned
by assignment to name of function
X ByVal and ByRef parameters
ByVal = pass by value
ByRef = pass by reference
Default is ByRef
v Interface
Basics
X IDE
= integrated
development environment
X Main IDE components
Title bar; Tool
bar; Menu bar; Toolbox
Project Design window
Form Design
window
Project
Explorer
Properties
Window
X Some basic objects
Form - where
other objects are placed; project may have several
Command button
- main use: allow user to trigger subroutines
Label - main
use: display of information to user
Textbox - main
use: receive input from user
Flexgrid - a
grid of cells
X Some basic properties
Note: Different types of objects have the different sets of properties
Name - the
identifier used to reference the object in code
Caption - What
is seen on the screen
Text - often
the input typed by user; also what is displayed in the
cell of a
FlexGrid
Height, Width -
determines size of object (in twips)
Left, Top -
determines placement of object with respect to its
container
Backcolor,
Forecolor - determines color of object and its caption
or text
Font -
determines size & type of font
v Data
X Identifiers
Used for:
objects, variables, subroutines, etc.
X Variables
Can be local,
module level, global, static
X Types
Integer, Long,
Single, Double, etc.
X Structures
Arrays, user
defined types (structures), arrays of objects