Professional Documents
Culture Documents
Reloaded
Third Edition
Chapter One
An Introduction to Visual Basic 2008
Objectives
After studying this chapter, you should be able to:
Define the terminology used in programming
Create a Visual Basic 2008 Windows-based
application
Manage the windows in the Integrated Development
Environment (IDE)
Set the properties of an object
Add a control to a form
Use the Label, Button, and PictureBox tools
Objectives (continued)
Programmers
Programs: directions given to computers
Programmers: people who write programs
Typical tasks performed by a programmer include:
Analyze a problem statement or project specification
Plan an appropriate solution and convert the solution
to instructions that the computer can follow
Programming Languages
Programming languages: used to communicate
with the computer
Object-oriented programming language: a language
that allows the programmer to use objects to accomplish
a programs goal
Object: anything that can be seen, touched, or used
Every object is created from a class
10
11
12
13
Figure 1-6: Solution and Visual Basic Project created by Visual Studio 2008
Microsoft Visual Basic 2008: Reloaded, Third Edition
14
15
16
17
18
19
20
Figure 1-10: Properties window showing the properties of the Form1.vb file
21
Properties list:
Left column displays names of properties
Use the Alphabetical or Categorized buttons to sort the
display of properties
22
23
24
25
Controls:
Objects displayed on a form
Represented as icons in the toolbox
Can be locked in place on the form
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Saving a Solution
An asterisk appears on the designer and Code
Editor tabs if a change was made since the last
time the solution was saved
41
42
43
44
45
46
47
48
49
50
51
52
53
Programming Tutorial
54
Programming Example
55
Summary
Program: directions given to a computer
Object-oriented programs focus on objects to
accomplish a task
Object: can be seen, touched, or used, and has
attributes that control its appearance and behavior
Class: a pattern from which an object can be
created
Applications created in Visual Studio 2008 are
composed of solutions, projects, and files
Microsoft Visual Basic 2008: Reloaded, Third Edition
56
Summary (continued)
Windows Form Designer window: used to create
GUI applications
Windows Form object is created from the Windows
Form class
Solution Explorer window: shows names of projects
and files in the solution
Properties window: lists an objects properties and
their values
All class definitions are contained in namespaces
Microsoft Visual Basic 2008: Reloaded, Third Edition
57
Summary (continued)
System.Windows.Forms namespace contains
definition of the Windows Form class and class
definitions for objects added to a form
Dot member access operator indicates a hierarchy
of namespaces
Name property: used to refer to an object in code
Text property of a form: specifies the text to be
displayed in the title bar of the form and in the
taskbar when running
Forms StartPosition property sets the position of
the form when it first appears at run time
Microsoft Visual Basic 2008: Reloaded, Third Edition
58
Summary (continued)
Recommended font is Segoe UI in 9-point size
Toolbox: contains tools for creating the GUI
A controls Text property value is displayed inside
the control
Controls on a form can be selected, sized, moved,
deleted, or locked at design time
Label control: contains text that a user cannot edit
Button control: performs an immediate action when
clicked
Picture box control: displays an image on a form
Microsoft Visual Basic 2008: Reloaded, Third Edition
59
Summary (continued)
Event procedure: the code that tells an object how
to respond to an event
Use the Class Name and Method Name list boxes
to select an object and event to code
Code Editor: provides code templates for each
objects event procedures
Can display line numbers in the Code Editor
window
Me.Close() instruction: can terminate an
application
Microsoft Visual Basic 2008: Reloaded, Third Edition
60
Summary (continued)
You should save your solution every 10-15 minutes
When an application is started in the IDE, the
computer creates an executable file
Use an assignment statement to set a property
value at run time
Can print your applications code, with or without
line numbers
Closing a solution closes all projects and files in it
Only one solution can be open in the IDE at any
time
Microsoft Visual Basic 2008: Reloaded, Third Edition
61