Home Projects With Visual Basic Express
Table of Contents

1. Building Projects Using Visual Basic Express
Preview 1-1
Requirements for Home Projects With Visual Basic Express 1-2
Introducing Visual Basic Express 1-3
Structure of a Visual Basic Express Project 1-6
Steps in Developing a Visual Basic Express Project 1-8
Starting Visual Basic Express 1-9
Visual Basic Express Integrated Development Environment (IDE) 1-10
Drawing the User Interface 1-17
Setting Properties of Controls at Design Time 1-20
Setting Properties at Run Time 1-25
How Names are Used in Control Events 1-26
Use of the Form Name Property 1-27
Writing Code 1-29
Saving a Visual Basic Express Project 1-34
Running a Visual Basic Express Project 1-35
Chapter Review 1-37

2. Overview of Visual Basic Express Programming
Review and Preview 2-1
A Brief History of BASIC 2-2
Variables 2-3
Visual Basic Express Data Types 2-4
Variable Declaration 2-5
Arrays 2-8
Constants 2-9
Variable Initialization 2-10
Intellisense Feature 2-11
Visual Basic Express Statements and Expressions 2-12
Type Checking 2-14
Visual Basic Express Arithmetic Operators 2-15
Comparison and Logical Operators 2-17
Concatenation Operators 2-19
Visual Basic Express Functions 2-20
String Functions 2-21
Dates and Times 2-22
Random Number Object 2-25
Math Functions 2-26
Visual Basic Express Decisions – If Statements 2-28
Select Case – Another Way to Branch 2-31
Visual Basic Express Looping 2-33
Visual Basic Express Counting 2-37
Chapter Review 2-39

3. Debugging a Visual Basic Express Project
Review and Preview 3-1
Errors in Visual Basic Express Projects 3-2
Debugging Visual Basic Express Projects 3-3
Opening a Visual Basic Express Project 3-5
Debugging Example 3-7
Using the Debugging Tools 3-9
Writing to the Immediate Window 3-10
Breakpoints 3-12
Viewing Variables in the Locals Window 3-15
Viewing Variables in the Watch Window 3-17
Call Stack Window 3-18
Single Stepping (Step Into) an Application 3-19
Procedure Stepping (Step Over) 3-21
Procedure Exit (Step Out) 3-22
Debugging Strategies 3-23
Chapter Review 3-24

4. Dual-Mode Stopwatch Project
Review and Preview 4-1
Project Design Considerations 4-2
Dual-Mode Stopwatch Project Preview 4-3
Form Object 4-7
Button Control 4-10
Label Control 4-12
Timer Control 4-14
Stopwatch Form Design 4-16
Code Design – Initial to Running State 4-20
Code Design – Timer Control 4-22
Using General Functions in Projects 4-24
Code Design – Update Display 4-27
Code Design – Running to Stopped State 4-29
Code Design – Stopped State 4-31
Dual-Mode Stopwatch Project Review 4-34
Dual-Mode Stopwatch Project Enhancements 4-35

5. Consumer Loan Assistant Project
Review and Preview 5-1
Consumer Loan Assistant Project Preview 5-2
Text Box Control 5-7
Loan Assistant Form Design 5-10
Code Design – Switching Modes 5-15
Form Design – Tab Order and Focus 5-19
Code Design – Computing Monthly Payment 5-23
Code Design – Computing Number of Payments 5-27
Code Design – Loan Analysis 5-31
Code Design – New Loan Analysis 5-37
Improving a Visual Basic Express Project 5-38
Code Design – Zero Interest 5-39
Key Trapping 5-41
Code Design – Key Trapping 5-44
Message Box Dialog 5-48
Code Design – Input Validation 5-53
Consumer Loan Assistant Project Review 5-62
Consumer Loan Assistant Project Enhancements 5-63

6. Flash Card Math Quiz Project
Review and Preview 6-1
Flash Card Math Quiz Project Preview 6-2
CheckBox Control 6-11
RadioButton Control 6-13
GroupBox Control 6-15
ScrollBar Controls 6-18
Flash Card Math Form Design 6-21
Code Design – Start Practice 6-31
Code Design – Problem Generation 6-35
Code Design – Obtaining Answer 6-43
Handling Multiple Events in a Single Event Procedure 6-46
Code Design – Choosing Problem Type 6-48
Code Design – Timing Options 6-51
Code Design – Presenting Results 6-58
Flash Card Math Quiz Project Review 6-60
Flash Card Math Quiz Project Enhancements 6-61

7. Multiple Choice Exam Project
Review and Preview 7-1
Multiple Choice Exam Project Preview 7-2
MenuStrip Control 7-17
OpenFileDialog Control 7-24
Multiple Choice Exam Form Design 7-27
Form Design – Initialization 7-34
Code Design – Exam File Format 7-37
Code Design – Generating Exam Files 7-38
Code Design – Opening an Exam File 7-43
Code Design – Reading an Exam File 7-46
Code Design – Error Trapping and Handling 7-53
Form Design – Selecting Options 7-58
Code Design – Start Exam 7-63
Code Design – Question Generation 7-66
Code Design – Checking Multiple Choice Answers 7-71
Code Design – Checking Type In Answers 7-77
Code Design – Checking Spelling 7-83
Code Design – Presenting Results 7-89
Multiple Choice Exam Project Review 7-92
Multiple Choice Exam Project Enhancements 7-93
8. Blackjack Card Game Project
Review and Preview 8-1
Blackjack Card Game Project Preview 8-2
PictureBox Control 8-13
PictureBox Examples 8-16
Blackjack Form Design 8-24
Code Design – Card Definition 8-31
Code Design – Card Shuffle 8-36
Code Design – Start New Game 8-39
Code Design – Start New Hand 8-41
Code Design – End Hand 8-44
Code Design – Display Dealer Card 8-45
Code Design – Display Player Card 8-47
Code Design – Deal New Hand 8-50
Code Design – Player ‘Hit’ 8-51
Code Design – Player ‘Stay’ 8-52
Blackjack Card Game Project Review 8-59
Blackjack Card Game Project Enhancements 8-60

9. Biorhythm Tracker Project
Review and Preview 9-1
Introduction to Biorhythms 9-2
Biorhythm Tracker Project Preview 9-4
MonthCalendar Control 9-9
DateTimePicker Control 9-11
Panel Control 9-12
Biorhythm Tracker Form Design 9-14
Form Design – Control Positioning 9-19
Code Design – Biorhythm Math 9-23
Code Design – Date Mathematics 9-25
Graphics Methods 9-26
Graphics Object 9-27
Colors 9-29
Pen Object 9-31
DrawLine Method 9-32
Graphics Methods (Revisited) 9-33
Persistent Graphics 9-36
Code Design – Drawing Biorhythm Curves 9-40
Code Design – Changing Dates 9-47
Code Design – Draw Legends 9-50
Code Design – Saving Birthdate 9-52
Biorhythm Tracker Project Review 9-57
Biorhythm Tracker Project Enhancements 9-58

10. Weight Monitor Project
Review and Preview 10-1
Weight Monitor Project Preview 10-2
TabControl Control 10-10
ListBox Control 10-13
SaveFileDialog Control 10-16
Weight Monitor Form Design 10-19
Form Design – Weight Editor Tab 10-23
Code Design – New Weight File 10-27
Code Design – Entering Weights 10-30
Code Design – Editing Weights 10-35
Sequential File Output (Variables) 10-39
Sequential File Input (Variables) 10-41
Code Design – Saving Weight Files 10-43
Code Design – Opening Weight Files 10-47
Configuration Files 10-51
Code Design – Configuration File 10-54
Form Design – Weight Plot 10-60
Code Design – Weight Plot 10-63
Code Design – Grid Lines 10-71
Brush Object 10-75
DrawString Method 10-76
Code Design – Plot Labels 10-79
Code Design – Weight Plot Trend 10-85
Weight Monitor Project Review 10-92
Weight Monitor Project Enhancements 10-93

11. Home Inventory Manager Project
Review and Preview 11-1
Home Inventory Manager Project Preview 11-2
ImageList Control 11-12
ToolStrip Control 11-15
ComboBox Control 11-18
Home Inventory Manager Form Design 11-21
Form Design – Toolbar 11-27
Form Design – Tab Order and Focus 11-32
Introduction to Object-Oriented Programming 11-36
Code Design – InventoryItem Class 11-38
Code Design – Inventory File Input 11-41
Code Design – Viewing Inventory Item 11-46
Code Design – Inventory File Output 11-51
Code Design – Input Validation 11-53
Code Design – New Inventory Item 11-57
Code Design – Deleting Inventory Items 11-63
Code Design – Editing Inventory Items 11-65
Form Design – Inventory Item Search 11-69
Code Design – Inventory Item Search 11-74
Printing with Visual Basic Express 11-76
Printing Document Pages 11-79
PrintDialog Control 11-82
PrintPreviewDialog Control 11-84
Code Design – Printing the Inventory 11-86
Home Inventory Manager Project Preview 11-90
Home Inventory Manager Project Enhancements 11-91

12. Snowball Toss Game Project
Review and Preview 12-1
Snowball Toss Game Project Preview 12-2
Snowball Toss Game Form Design 12-7
Form Design – Choosing Options 12-15
Code Design – Configuration Files 12-20
Animation with Visual Basic Express 12-22
Drawing Images with IconEdit 12-27
Code Design – Sprite Class 12-30
Code Design – Start/Stop Game 12-34
Code Design – Moving the Tossers 12-39
Code Design – MovingSprite Class 12-42
Code Design – Throwing Snowballs 12-43
Code Design – Collision Detection 12-49
Code Design – Zombie Snowmen 12-52
Code Design – Playing Sounds 12-59
Code Design – One Player Game 12-66
Snowball Toss Game Project Review 12-74
Snowball Toss Game Project Enhancements 12-75
Appendix. Distributing a Visual Basic Express Project

Preview A-1
Distribution of Files A-2
Application Icons A-5
Using IconEdit A-7
Running a Project on Another Computer A-12​