VB Controls and Events: Introduc) On
VB Controls and Events: Introduc) On
Introduc)on
Program
Planning
and
Flowcharts
Visual
Basic
Visual
basic
Interface
VB
Controls
CreaGng
a
Project
8/25/10
General purpose, machine-independent language Powerful and exible language Popular (used by many programmers, its been around since . well MS DOS. Yeah, Bill Gates wrote it!) Portable (works on all PCs) Small language (few components) Modular (easily maintainable)
VB
Programs
Developing
a
VB
Program
Design
the
GUI
(bu^ons,
text
boxes,
etc.)
Determine
the
events
that
the
controls
(bu^ons,
etc.)
will
recognize
Write
the
procedures
for
those
events
Whats
an
EVENT?
CLICK!
Running a VB Program
Whats a PROCEDURE?
VB monitors the controls in the window for events When it detects an event, execute procedure for that event Return to monitoring
8/25/10
Flowchar)ng
Flowchart
Flowchart
Symbols
Start/Stop
Start
This can save your &^%$ when you lose track of what youre doing!
Line
Decision
no yes Process
Stop
Pseudocode
Program
Purpose:
Determine
the
proper
number
of
stamps
for
a
leCer
Read sheets Set the number of stamps to sheets/5 Round the number of stamps up to the next whole number Display the number of stamps
End
8/25/10
Decisions
Flowchart
Pseudocode
No
Is condiGon True?
Yes
Process Step(s) 2
Process Step(s) 1
Else
Process
step(s)
2
End if
Pseudocode
BEGIN
Average
Grade
sum=0
count
=
0
Input
Grade
LOOP
WHILE
grade
>
0
sum
=
sum
+
grade
count
=
count
+1
END
LOOP
average
=
sum/count
Input Grade
Note: This program will crash if there are no grades input, i.e., count = 0
Stop
8/25/10
VB Interface
8/25/10
8/25/10
8/25/10
8/25/10
Design GUI
Create Objects
Test
Homeworks
Install
Do
VB-2008
from
the
MS
website
or
the
CD
at
back
of
the
book
Homework problems in VB How to create VB projects and solve problems Screenshots and paste them into Word docs Your computer
8/25/10
Summary
Program
Planning
and
Flowcharts
Visual
Basic
Visual
basic
Interface
VB
Controls
CreaGng
a
Project
10