Title: Overview of Microsofts Visual Basic
16
Chapter
Overview of Microsofts Visual Basic
26
- Presentation Outline
- Overview of Visual Basic
- Components of VB Database Applications
- VB Projects
- VB Development Environment
- Creating a VB Database Application
- And much, much more
36
What is Visual Basic (VB)?
- Microsoft VB is a development language that
enables programmers to create Windows-based
programs.
46
What is Visual Basic (VB)?
- An event-driven programming language
- Program statements execute in response to user
actions or to system actions.
56
- In VB, you work with objects, which have
properties and methods. - Objects i.e., forms (windows, dialog boxes,
etc.) and controls (elements you place inside a
form, such as a text box, command button, etc.) - Properties tell something about an object
(name, color, size, location or how it will
behave) - Methods actions associated with objects (Move,
Print, Resize, Clear)
66
Components of a VB Program
- Project file every VB program has an individual
project file, with a .vbp extension - Specifies properties of the program and names of
the individual components of the program.
76
Components of a VB Program
- Project file
- Main components of a VB project
- Forms (.frm)
- Visible interface that the user sees and
interacts with and the - Associated code that responds to user and system
actions
86
Components of a VB Program
- Project file
- Main components of a VB project
- Standard Modules
- Contains only code
- Used to store declarations for variables that are
used in multiple forms
96
Components of a VB Program
- Project file
- Main components of a VB project
- Standard Modules (contd)
- Procedure manipulates variable values
- Function returns a single value based on
parameters that are passed to the function.
106
Components of a VB Program
- Controls the visible items on a form
116
- When VB is started, a new project is created,
which corresponds to an individual user
application - You can select the type of project it will be,
which specifies how the project file is compiled.
126
Visual Basic project types
136
- The VB Development Environment
- Integrated development environment (IDE)
- Environment for developing programs
VB IDE components
146
156
- The VB Development Environment
- Main IDE components include
- The Toolbar provides quick access to menu bar
commands for opening - The Object window shows the form and the position
of the controls on the form - The Toolbox contains icons that are used to
create form controls
166
- The VB Development Environment
- Main IDE components include
- The Project Explorer displays a hierarchical list
of the components of the current project - The Properties window is used to assign and
display the properties of the object that is
currently selected in the Form window
176
- Creating a VB Database Application
- Data control
- Form control that is attached to a database table
- Used to sequentially step through the record to
view the items
186
- Creating a VB Database Application
196
Modifying Form Properties
- The properties of a VB object specify the
objects appearance and behavior - Name property Determines how objects are
internally identified within the project. - Must begin with a letter and can contain
characters, numbers, or underscores. - Border Style determines whether the user can
resize the form - Caption the form description displayed in the
forms title bar
206
Modifying Form Properties
- The properties of a VB object specify the
objects appearance and behavior - MaxButton allows the user to maximize the form
so that it is displayed full-screen - MinButton allows the user to minimize the form
- StartUpPosition determines where the form is
displayed on the screen when the application is
running.
216
Saving VB Projects
- A VB project is saved in a file with a .vbp
extension - Forms are saved in files with an .frm extension
- Note It is very important to always save the
project .vbp file and the form .frm file in the
same folder in your file system.
226
Using VB with a DB
Figure 6-12 Microsoft data access architecture
using ODBC
236
Creating an ActiveX Data Control
- ActiveX data control
- A control that is displayed on a form
- Different from an ordinary form control because
it is associated with a recordset - A specific set of database records based on a SQL
query
246
Creating an ActiveX Data Control
Figure 6-14 ActiveX data control
256
Code in VB Programs
- A VB project consists of forms and standard code
modules - Every form and every code module has a section
called the General Declarations section - Contains declarations for variables, and the code
for functions and procedures
266
Variables in VB Programs
- Visual Basic code has variables and data types
just like other programming languages - It is a good programming practice to always
declare variables before using them - VB does not require you to declare variables, but
allows you to assign a value to a variable
without declaring it first. This can lead to
errors
276
Displaying VB Programs Using Web Pages
- Visual Basic projects can be created to make
standard executable files - Also can be created using different ActiveX
options to make programs that can be installed
and/or run by clicking a hyperlink on a Web page - When creating a Internet package using Package
and Development Wizard, the Wizard creates an
HTML file containing the command for the
hyperlink that references the ActiveX document
286
Presentation Summary
- Visual Basic is a development language and used
to create Windows-based applications - A VB project can have forms and code modules
- Visual Basic has an integrated development
environment (IDE) with multiple windows for
displaying and modifying project components
296
Presentation Summary
- Visual Basic forms and controls have properties,
which determine how the forms and controls look
and function - An Open Database Connectivity (ODBC) driver is a
program that allows an application to interact
with a database - You can create a VB project that is an ActiveX
document, which has both visual components and
code, and can be displayed as a Web page using
the Microsoft Internet Explorer browser
306
Chapter
Thank you for your attention this evening! Good
night!