You are on page 1of 11

F -X C h a n ge F -X C h a n ge

PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Tutorials Next

Welcome!
Visual Basic 6.0 programming for beginners!

Class for: Tuesday, January 05, 2010


Today we will start our study of Mic rosoft Visual Basic projec ts
through a number of sample assignments and described sourc e c ode
to master the fine points of using the VB language in a commercial
environment ...

Visitors from all over the world!

¡Bienvenido! Bienvenue! Willkommen! Howdy, Mate!

First of all,
let me say
Hello! to my
many,
many, loyal
students
particularly
in India, the
Philippines
and
Malaysia.
Over the
years you
have proven
to be among
the best
consumers
or my VB
tutorials and
http://www.profsr.com/vb/vbintro.htm… 1/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
I appreciate
N

N
y

y
bu

bu
it. My
to

to
k

k
lic

lic
C

C
w

w
m

m
statistic s
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

tell me that
on the other
side of the
world from
here (here
being
Canada)
students
and
programmers
in tec hnic al
colleges and
software
training
centres are
studying my
courses and
that makes
me glad. I'll
really try to
do as muc h
as I can for
you.

Now, I just
want to
apologize
that the
tone of
most of the
referenc es
and lessons
is so North-
American. I
would love
to give you
examples,
samples and
situations
based on
your c ultural
norms but
the truth is
that I don't
know
enough
about them,
yet. For
example, I
have
absolutely
no idea how
a cric ket
game is
http://www.profsr.com/vb/vbintro.htm… 2/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
played!
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
In my
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

defense,
pic ture to
yourself, if
you c an,
that as I
write this I
see outside
my window
that there is
a metre of
fresh snow
on the
ground and
the
temperature
is a windy -
12o C. The
only subjec t
of
discussion
by sports
fans is
yesterday's
hockey
game (ic e
hoc key,
that is).

However, as a French-Canadian I do have a few things in c ommon


with you in that I am not an American either and I too have to get
by with English as a sec ond language.

If you have suggestions that would make the tutorials more


interesting, please do not hesitate to pass them along.

About the Visual Basic 6


tutorial
What kind of programming projec t do you have
in mind?

Do you intend to launch a million-dollar business


on the Internet?

Maybe just a simple dating service?


http://www.profsr.com/vb/vbintro.htm… 3/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
N

N
y

y
bu

bu
Or do you just want to get your hands on that
to

to
k

k
lic

lic
C

C
w

w
m

m
college degree and then head-out into the
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

urban jungle?

I'll tell you a secret - in all those c ases,


computer programming skills will really help! You
don't really have to be a geek to be in
computers. But since you're here and reading
this, I guess you know that already.

Whether
you're a
beginner at
the
programming
game or a
programmer
who as some
experience
with other
languages,
you'll find
that Visual
Basic 6 is just
about the
best way to
start getting
the right
training with
the objec ts
approach to
programming.

Mic rosoft
Want to try the boasts that
great Linux OS there are 3.2
without risk? million users
There's a small of Visual
distribution that Basic 6 in the
will run from world.
within Windows Sometimes it
- you c an seems that at
explore as much least half of
as you want. them have
Visit written a
Linux4Windows book, a
for the free magazine or a
tutorials, tutorial on
downloads and the subject.
articles. The amount
of information
available is
overwhelming.
The problem
is that
everything
http://www.profsr.com/vb/vbintro.htm… 4/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
you need to
N

N
y

y
bu

bu
know is there,
to

to
k

k
lic

lic
C

C
w

w
m

m
somewhere,
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

but when
you're just a
beginner you
can't even
know where
to begin to
look. So, why
another
tutorial?

Well, this Visual Basic tutorial is different. For one thing it's meant
for the real beginner - the one who doesn't know his Form from a
hole in the ground. It c overs all the basic s to get you programming
a real applic ation and sets you on the road to bigger and better
things. And it has lots of easy to follow examples, sample projec ts
and Visual Basic 6 source c ode that you can evaluate and adapt to
your own needs. Also, it's organized like a textbook, not a reference
manual. You do not have to know what you're looking for in order to
find it. If you follow the lessons, in order, you go through all the
fundamentals required to start produc ing real c ode.

For game programmers ...


If you're into games development, in Visual Basic , C# or any
other language, here's a new site that's very promising. The site
is not fully developed yet but it will soon have a lot of resources
for the game programmers c ommunity.
Check it out at: Game developers' Web.

Top

About VISUAL BASIC 6


Visual Basic 6 is not your grandfather's BASIC! If your
knowledge of programming is limited to the QBASIC you toyed
with in high sc hool, you'll think you've landed on a different
planet. You may still see the oc casional GoTo hanging around
but, for the most part you will be in unfamiliar territory. For one
thing, the word Basic in Visual Basic is not an ac ronym anymore.
It used to be. When the language was invented in the early
70's, BASIC stood for Beginners' All-purpose Symbolic
Instruc tion Code, thus the acronym (word formed from the first
letter of several words, in upper-c ase). It is c ertainly not just

http://www.profsr.com/vb/vbintro.htm… 5/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
for beginners, and although it is quite versatile, I don't know if
N

N
y

y
bu

bu
I'd call it exac tly All-purpose. And while it is still Instruction
to

to
k

k
lic

lic
C

C
w

w
m

m
Code, it is more than Symbolic now. But THE big differenc e is
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

the Visual aspec t of it where you work with windows and ic ons
and pic tures and multimedia.
It really is a lot of fun!

Before you start


developing a
Visual Basic 6
applic ation you
should be aware
that some
programming
knowledge is
useful. If you
have used
BASIC or Pascal
or C before you
got here, that's
OK. If you did
learn one of
those
languages, you
were working in There's
a procedural money to
fashion: when be made
you type RUN with this!
the program
starts at the If you're
beginning and developing
basically follows VB
the instruc tions applic ations,
going down the there may
list, skipping be a big
here and there market for
acc ording to them. There
c ontrol are all kinds
instruc tions until of ways to
it finds some sell your
kind of END knowledge
statement. That on the
is not how Internet.
Visual Basic
operates. Why don't
Rather than you take a
proc edural it is look at our
event-driven. free
There will be Internet
more on that marketing
subject in the course.
next lesson.
Even if it's
However, you just for a
do have to write hobby, you'll
Visual basic 6 be amazed
c ode to program at what you
http://www.profsr.com/vb/vbintro.htm… 6/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…
at what you

!
W

W
O

O
the events -
N

N
y didn't know

y
bu

bu
there are loops
to

to
k

k
you c ould
lic

lic
C

C
w

w
m

m
and c onditions
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k
do! c u -tr a c k

and arrays. We
will not be
c overing the
fundamentals of
programming as
suc h - you
should be
familiar with the
basic c onstructs
suc h as the
IF...THEN...ELSE
or the
FOR...NEXT
statements.

Top

About Visual Basic versions


You may be aware that there are several dialects of the Visual
Basic language in use. This tutorial is on standard Visual Basic .
It uses the VB IDE (Integrated Development Environment)
to let you c reate standalone Visual Basic applic ations that c an
be distributed as .EXE files. Visual Basic for Applications
(VBA) is the language used to tie Mic rosoft Offic e products
together. It links Word and Excel applications, for example.
Although it is very similar to standard VB, it does have several
partic ular tec hniques that must be learned on their own.
VBScript is a small subset of Visual Basic, with limited
instruc tions, mostly used in Internet applications.

As for version, this tutorial is based upon Visual Basic 6.0. You
may have ac cess to version 4 or 5 in your environment. Don't
worry about it. Of c ourse Mr. Gates would like us to rush out to
the store and buy the latest release as soon as it hits the
shelves but we are not all as, shall we say, fortunate, as Mr.
Gates when it c omes to spending money. Right now, when a
new version is announced, most of the improvements cover
Internet acc ess or Class libraries, etc. At this level of training,
we will not be using most of those fac ilities and so, one version
is just about as good as another. A form is a form and a button
is a button. There may be slight differences in the interfac e
between versions but those will not matter muc h.

The only problems oc c ur when you try to run an applic ation on


a lower version of the software. It normally doesn't work. But
the hardest part of creating an applic ation is usually in writing
the c ode. Some sc ripts c an run into the 100's of line.
Fortunately the script is just text and you c an work around the
version problem with Cut and Paste operations. You will have to
http://www.profsr.com/vb/vbintro.htm… 7/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
redraw the forms, buttons and so on but, that is a minor
N

N
y

y
bu

bu
inc onvenienc e when you can paste in the c ode for all those
to

to
k

k
lic

lic
C

C
w

w
m

m
objec ts.
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

In order to be as acc essible as possible, the code downloads at


the end of the tutorial will all be in the form of text files that
can be pasted into any version of VB.

Visual Basic .NET is now available. Although very similar in


most ways to Visual Basic 6, Visual Basic .NET does have
signific ant differences in its approac h. For one thing, VB .NET is
now completely objec t-oriented, whic h isn't the case with Visual
Basic 6. An applic ation that runs well in VB 6 will have to be
converted, using a conversion wizard to run on VB .NET.
Mic rosoft tell us that the c onversion wizard will convert 95% of
the code (an optimistic estimate?). Regardless, that leaves at
least 5% that will have to be converted manually. That means
that a lot of people will wait to see further improvements before
jumping to the new version. And add to that the fac t that
Visual Studio .NET, the parent framework for VB has a huge
infrastruc ture. It requires lots of system resourc es. For example,
you need at least 128 meg of RAM. Exc use me! When I look at
the real world I see thousands upon thousands of perfec tly
good computers with less than 128 meg of memory.

Before too long we'll be doing a tutorial on "Converting Visual


Basic 6 to Visual Basic .NET" and eventually we will c onvert this
tutorial to VB .NET also.

Here's your lead to a great new Visual Basic training site!


If you need more information and examples of VB 6 in action,
you might want to visit this site for
Free VB 6 tutorials and sample source code samples.

However, if you are just getting into programming or into VB, the
basic stuff doesn't c hange. You still need to know how to c reate a
form, how to put c ontrols on a form, how to write a loop or a
decision struc ture. That hasn't c hanged in ages and that you c an
still learn with Visual Basic 6. I see installations out in the real world
still doing tons of interesting work with versions 4 or 5 of Visual
Basic !

All about food and wine ...


If you're now ready to take a break, visit this great website
devoted to wine and food. From a Web developer's viewpoint,
one of the interesting aspects of the site is that it is developed
entirely using PHP programming.
For all kinds of useful info: The Ultimate fine wine and food
pairing guide.

Top

http://www.profsr.com/vb/vbintro.htm… 8/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Visual Basic 6.0 Tutorial Content


Lesson 1

The Visual Basic 6 environment


Defining terms
Creating a Visual Basic Project
Prac tice project - Building a Football Sc oreboard

Lesson 1b

Improving the VB applic ation


Using a step-by-step approach
Writing a VB procedure
Calling procedures

Lesson 2

Using the Visual Basic 6 c ode editor


Adhering to programming standards
Data types, variables and c onstants in Visual Basic
Using operators
Control struc tures - IF...THEN, Select Case, DO...LOOP, FOR...NEXT
Prac tice assignment - Upgrading the Sc oreboard

Lesson 3

Designing the Visual Basic Applic ation


Working with users
Guiding princ iples
Choosing a Visual Basic interfac e style

Lesson 4

Defining the Visual Basic Form


Standard c ontrols: Pic ture, Frame, CommandButton, Label, TextBox,
Chec kBox, etc .
Visual Basic prac tic e assignment: Creating a Payroll Form

Lesson 5

Arrays
More c ontrols: ListBox, ComboBox
Properties and Methods of objects in Visual Basic
Building a file search application: DriveListBox, DirListBox, FileListBox

Lesson 6
http://www.profsr.com/vb/vbintro.htm… 9/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
N

N
y

y
bu

bu
Building a Menu
to

to
k

k
lic

lic
C

C
Debugging Visual Basic code
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Error trapping

Lesson 7

Manipulating text - string functions


Visual Basic func tions for dates, numbers
Using the Windows Clipboard and Screen objec ts
Creating Copy, Paste, Cut, Delete functions
Pictures, Graphics and Drawing c ontrols in Visual Basic
Multimedia - inc orporating sounds and pic tures
Building a CD player in c ode

Lesson 8

Working with Visual Basic files


Writing and reading a Sequential-acc ess file
Sample projec t: the Address Book
Creating a sequential output form
Creating and using a Random-ac cess file

Lesson 9

Creating a Mic rosoft Ac c ess database - refer to SQL tutorial


The Projec t Management example
The Data c ontrol
Visual Basic Bound c ontrols - TextBox controls linked to database
Validating data - ensuring database integrity
Finding a spec ific rec ord in the database

Lesson 10

Using multiple tables from the database


Creating multiple data c ontrols
Using Data Bound List Controls
Using VISDATA - the Visual Basic Data Manager

Lesson 11

Downloads - sample Visual Basic 6 c ode and database


with new examples

Lesson 12

New sample application: Projec t management


Visual Basic 6 ADO database programming
with c onnec tion to MySQL database server.

http://www.profsr.com/vb/vbintro.htm… 10/11
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Visual Basic 6 Projects tutorial with sour…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
If you haven't found the Visual Basic resource you're looking for,
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
use our Google Search box for more information.

Search

Top

Home | Tutorials | Contact | Sitemap | Add URL | Privacy policy

http://www.profsr.com/vb/vbintro.htm… 11/11

You might also like