Introduction to Visual Basic
Computer programming - process of creating computer software using a
programming Language.
Kinds of Programming Language are Machine Language, Assembly
Language, Third Generation Language, Fourth Generation Language, Fifth
Generation Language and Natural Language.
Procedure-Oriented High-Level Languages - programs that the programmer
has to design and write every single step to do a certain task or solve a particular
problem. It is sequential and its execution is on a line-by-line basis.
Examples: Ada, ALGOL, BASIC, C, C++, C#, COBOL, Commom Lisp, Fortran,
Pascal
Object-Oriented / Event-Driven Languages - program applications in windows
by focusing on objects (such as button and scroll bars) and events (mouse actions
such as clicking and scrolling). It is also event-driven, such that when a particular
event occurs, a program is executed.
Examples: Visual [Link], Java, C#, C++, PHP5, Perl, Ruby, Smalltalk
Visual Basic
a third-generation language
Based on BASIC (Beginner’s All-purpose Symbolic Instruction Code) and
provides a graphical programming environment in developing user
interfaces.
Programmer has the ability to drag and drop controls (to create
buttons, labels, textboxes, list-boxes, checkboxes and other dialog
boxes)
allows quick creation of prototype graphical applications that is why it
is often called a Rapid Application Development (RAD) system
History of Visual Basic
Basic - also called Dartmouth BASIC is designed by John George Kemeny and
Thomas Eugene Kurtz at Dartmouth College in New Hampshire, USA. It became
popular with the emergence of the IBM PC running in DOS (Disk Operating System)
several versions of BASIC: GW-BASIC, Quick BASIC, IBM BASICA,
Borland’s Turbo Basic
Visual Basic 1.0 – introduced and released by in 1991 by Microsoft, original with
the BASIC program. Codes are automatically generated using “drag and drop”
method
Visual Basic 2.0 (November 1992) - increased speed and easier usage
Visual Basic 3.0 (1993) - used for custom-made programs for business applications
Visual Basic 4.0 (1995) - capable of creating 16-bit and 32-bit program
Visual Basic 5.0 (February 1997) - as purely 32-bit version, provides ability to
compile to a native
executable code
Visual Basic 6.0 (1998) - most stable visual basic, it offers the capability to create
web based
applications
Visual Basic. NET (2002) - also called Basic 7.0, first Visual Basic running on
the .NET framework Visual
Basic 2005 (VB 8.0) (2005) - .NET framework was dropped
Visual Basic 2008 (VB 9.0) (November 19, 2007) - simultaneously with
Microsoft .NET framework 3.5
Visual Basic 2010 – it has become wholly Object-Oriented Programming (OOP) at
par with the likes of C++, Java and C#. It is classified as a RAD (Rapid Application
Development) system tool created by Microsoft to be an Integrated Development
Environment (IDE) for software development.
RAD - allows ease and quick creation of prototypes
IDE - software that provides the complete development facilities to programmers in
order to develop programs.
In IDE
Source code editor - usually a text editor program used by
programmers to edit programs.
Visual Studio has Intelligence - feature that make suggestions for
programmer, to facilitate programming and lessen mistakes in
coding
the syntax
Interpreter and/or compiler – a program that allows the language
to
be machine readable.
Debugger - a program to check to test and check for errors on
target program.
Build Automation - automating tasks to facilitate programming
activities
A Visual Basic Programmer needs to learn the following:
Creating windows application
Coding
Debugging
Deploying the application
Object-Oriented Programming - uses objects to design an application and program;
programming paradigm that attempts to mimic the way people think and deal the
world.
Features:
Encapsulation - refers to data bundling and restrictions to access
object’s data; it is a way of hiding data from the outside
Modularity – is a programming design technique that allows
breaking down of the software into modules and each module
accomplishes a given task on its own
Data Abstraction - is where data and program are represented by
their close image representation
Polymorphism - is the ability to create variables, functions and
objects and allow more than one form.
Inheritance - is reusing codes of existing objects, and the
establishment of related objects with similar attributes and
behavior.
Messaging - is a means of sending and receiving messages as a
form of communication between processes.
Concepts of Classes, Objects, Properties, Methods and Events
Class – a blueprint or template on which all objects are based upon. Each object is
based on a class and from this class one can create an instances of itself. A class
defines integral members.
Example: “Mango” is an instance of the class “Fruit”. Or “Mango” is a
kind of “Fruit”
Object – is an instance of a class. Object can be handled and manipulated by the
commands of programming language. The object handling will be on its value,
variable or data structure.
Example: a “Cow” is an object or instance of the class “Animal”
Property - it should have a name usually provided by the programmer, name
should be meaningful
Example: the object “Mango” has color and size as its properties
Method – is a function or procedure associated with class. It defines the exhibited
behavior of the object at program runtime. It contains statements that will be
executed when the
method is called.
Example: Open and close
Event - a user-initiated action; program that changes its behavior in response to
an event is called an event driven program. Each user-initiated action causes an
event to
occur.
Ex: a mouse click, a keyboard stroke
Event Procedures – are codes written by the programmer to react to an event; if
code is not written, VB will simply ignore the event.
Basic Steps for Writing a Visual Basic Project
Explore the files
Design the user interface
Set up the Properties of the controls
Coding – following the syntax rules of VB
Various Timing and Modes in VB
Design Time – time spent in writing and designing the codes for the user interface
Run Time - time spent when a user runs an application
Break Time – time spent in checking, debugging, and other situations
Errors in VB
Syntax Error (Compile Error) - wrong spelling, symbols, spacing
Logic Error – a program bug; produce an incorrect or undesired output.
Runtime Error – detected during execution of the program or when the program is
running