Objective
Learn to designand develop Windows-based applications using
Visual Basic.NET programs that meet commercial programming
standards.
At the end of this course, your program design and coding should
be satisfactory.
VB supports programming projects that run in both:
Microsoft Windows and,
Web (Internet) environments.
This course focuses on the Windows operating system(s).
3.
What is VISUALBASIC?
• Visual Basic is a high level programming
language which evolved from the earlier DOS
version called BASIC.
• BASIC means Beginners' All-purpose Symbolic
Instruction Code.
• It is a very easy programming language to
learn.
• Visual Basic allows you to develop Windows
(Graphic User Interface - GUI) applications
that have a familiar appearance to the user.
4.
Running environment
Modern programsrun in a Graphical User Interface (GUI)
environment. You can open up any desktop program or web
browser and examine the GUI.
This interface includes:
Buttons (some with Icons and Graphical Images) and Menus
on which you point and click.
TextBox controls in which you type information.
Graphical images to guide a system user in using the program.
Other components.
5.
Object-Oriented Programming Terminology
VBis an object-oriented programming language.
Means you work with objects in building an application.
Examples: Form objects, Button objects, TextBox objects, Label objects,
PictureBox objects, and more.
VB is also termed an event-driven programming language.
Means you will write program code that responds to events controlled
by the user.
Example events include: clicking a button or menu, opening or Closing a
form, moving the mouse over the top of an object.
6.
Object-Oriented Programming Terminology
Inorder to work with VB, you need to understand "object" terminology as
defined in the following table.
Object-Oriented Programming Terminology table
Terminology Definition
Object
A thing – like a noun in English. Examples include forms and controls you place on
forms such as buttons, text boxes, and icons.
Properties
Objects have properties – like adjectives in English. Properties describe object behaviors.
Examples of properties include Text, Name, BackColor, Font, and Size.
Method
Like a verb in English – these are the actions that objects exhibit. Examples include
methods to Show and Hide forms and methods to Print and Close forms.
Event
Events are actions usually triggered by the system user such as clicking a button;
however, events can also be triggered by the actions of objects.
Class
This is a really abstract term – it is a sort of template for an object. For example, all
forms belong to the Form class of object. All buttons belong to the Button class of
object. Classes include definitions for object properties, methods, and associated events.
7.
Some features ofVisual Basic
Full set of objects - you 'draw' the application;
Lots of icons and pictures for your use;
Response to mouse and keyboard actions;
Clipboard and printer access;
Full array of mathematical, string handling, and graphics functions;
Can handle fixed and dynamic variable and control arrays;
Sequential and random access file support;
Useful debugger and error-handling facilities;
Powerful database access tools;
ActiveX support;
Package & Deployment Wizard makes distributing your applications
simple.
8.
Different version ofVisual Basic
Visual Basic 1.0 for DOS was released in September 1992.
Visual Basic 2.0 was released in November 1992.
Visual Basic 3.0 was released in the summer of 1993 and came in Standard and
Professional versions.
Visual Basic 4.0 (August 1995) was the first version that could create 32-bit as well as 16-
bit Windows programs. It has three editions; Standard, Professional, and Enterprise. It
also introduced the ability to write non-GUI classes in Visual Basic.
With version 5.0 (February 1997), Microsoft released Visual Basic exclusively for 32-bit
versions of Windows.
Visual Basic 6.0 (Mid 1998) improved in a number of areas including the ability to create
web-based applications.
9.
Derivative languages
• VisualBasic for Applications (VBA) is included in many Microsoft
applications (Microsoft Office), and also in many third-party products like
AutoCAD, and Business Objects Desktop Intelligence.
• VBScript is the default language for Active Server Pages. It can be used in
Windows scripting and client-side web page scripting.
• Visual Basic .NET is Microsoft's designated successor to Visual Basic 6.0,
and is part of Microsoft's .NET platform.
• StarOffice Basic is a Visual Basic compatible interpreter included in
StarOffice suite, developed by Sun Microsystems.
• Gambas is a Visual Basic inspired free software programming language.
10.
Structure of aVisual Basic Application
• Forms - Windows that you create for user interface
• Controls - Graphical features drawn on forms to allow user
interaction (text boxes, labels, scroll bars, command buttons,
etc.) (Forms and Controls are objects.)
• Properties - Every characteristic of a form or control is
specified by a property. Example properties include names,
captions, size, color, position, and contents. Visual Basic
applies default properties. You can change properties at
design time or run time.
11.
Structure of aVisual Basic Application
• Methods - Built-in procedure that can be invoked to
impart some action to a particular object.
• Event Procedures - Code related to some object. This is
the code that is executed when a certain event occurs.
• General Procedures - Code not related to objects. This
code must be invoked by the application.
• Modules - Collection of general procedures, variable
declarations, and constant definitions used by application.
The Integrated DevelopmentEnvironment (IDE)
• Toolbars with shortcut icons are shown
below the menus.
• Form Designer also termed the
Document Window (Displays open
documents such as the Form1 shown in
the figure)
• Solution Explorer Window – displays
filenames for files that comprise a
project.
• Properties Window – displays properties
of the currently selected object.
• ToolBox Window – this is shown along the left edge of the figure in collapsed
display. (Next Slide)
• Across the top are menus with different options used in the designing of an
application.
Steps in developingapplication
There are three primary steps involved in
building a Visual Basic application:
• Draw the user interface
• Assign properties to controls
• Attach code to controls
We will look at each step.