259x Filetype PDF File size 0.54 MB Source: site.iugaza.edu.ps
i
Course Notes for:
Learn Visual Basic 6
© Lou Tylee, 2000
KIDware
PO Box 28234
Seattle, WA 98118
(206) 721-2556
FAX (508) 464-0455
E-Mail: support@kidwaresoftware.com
Web Site: www.kidwaresoftware.com
ã KIDware (206) 721-2556
PDF created with FinePrint pdfFactory Pro trial version http://www.fineprint.com
ii Learn Visual Basic 6
Notice
These notes were developed for the course, “Learn
Visual Basic 6” They are not intended to be a
complete reference to Visual Basic. Consult the
Microsoft Visual Basic Programmer’s Guide and
Microsoft Visual Basic Language Reference
Manual for detailed reference information.
The notes refer to several software and hardware
products by their trade names. These references are
for informational purposes only and all trademarks are
the property of their respective companies.
Lou Tylee
Course Instructor
ã KIDware (206) 721-2556
PDF created with FinePrint pdfFactory Pro trial version http://www.fineprint.com
Contents iii
Learn Visual Basic 6
Contents
1. Introduction to the Visual Basic Environment
Preview.....................................................................................................1-1
Course Objectives.....................................................................................1-2
What is Visual Basic?................................................................................1-2
Visual Basic 6 versus Other Versions of Visual Basic...............................1-4
Structure of a Visual Basic Application......................................................1-5
Steps in Developing Application................................................................1-6
Drawing the User Interface and Setting Properties...................................1-7
Example 1-1: Stopwatch Application - Drawing Controls........................1-11
Setting Properties of Objects at Design Time.........................................1-12
Setting Properties at Run Time...............................................................1-13
How Names Are Used in Object Events..................................................1-13
Example 1-2: Stopwatch Application - Setting Properties.......................1-14
Writing Code...........................................................................................1-16
Variables.................................................................................................1-17
Visual Basic Data Types.........................................................................1-17
Variable Declaration................................................................................1-17
Example 1-3: Stopwatch Application - Attaching Code...........................1-21
Quick Primer on Saving Visual Basic Applications..................................1-24
Class Review...........................................................................................1-25
Practice Problems 1................................................................................1-26
Problem 1-1. Beep Problem
Problem 1-2. Caption Problem
Problem 1-3. Enabled Problem
Problem 1-4. Date Problem
Exercise 1: Calendar/Time Display.........................................................1-27
ã KIDware (206) 721-2556
PDF created with FinePrint pdfFactory Pro trial version http://www.fineprint.com
iv Learn Visual Basic 6
2. The Visual Basic Language
Review and Preview..................................................................................2-1
A Brief History of Basic.............................................................................2-2
Visual Basic Statements and Expressions................................................2-3
Visual Basic Operators..............................................................................2-4
Visual Basic Functions..............................................................................2-5
String Functions........................................................................................2-6
Rnd (Random Number) Function..............................................................2-9
Example 2-1: Savings Account...............................................................2-10
Visual Basic Symbolic Constants............................................................2-14
Defining Your Own Constants.................................................................2-14
Visual Basic Branching - If Statements...................................................2-15
Key Trapping...........................................................................................2-16
Example 2-2: Savings Account - Key Trapping.......................................2-18
Select Case - Another Way to Branch....................................................2-20
The GoTo Statement...............................................................................2-21
Visual Basic Looping...............................................................................2-21
Visual Basic Counting.............................................................................2-23
Example 2-3: Savings Account - Decisions.............................................2-24
Class Review...........................................................................................2-27
Practice Problems 2................................................................................2-28
Problem 2-1. Random Number Problem
Problem 2-2. Price Problem
Problem 2-3. Odd Integers Problem
Problem 2-4. Pennies Problem
Problem 2-5. Code Problem
Exercise 2-1: Computing a Mean and Standard Deviation......................2-29
Exercise 2-2: Flash Card Addition Problems...........................................2-30
ã KIDware (206) 721-2556
PDF created with FinePrint pdfFactory Pro trial version http://www.fineprint.com
no reviews yet
Please Login to review.