CSCI 220 Introduction to Programming with Visual Basic
History and Background
I. History of Programming
A. Earliest Examples
1.Sumerian Algorhythms
2.Al Kharythmi by Al Jabbar
3.Pascaline 1659
4.Analytical Engine 1834
5.Lady Ada
B.Birth of programming languages:
1.Eniac -cords and wires
2.Grace Hopper and A0- first compiler
3.(first bug--- origins of debugging)
C.Higher level languages
1.Fortran- 1st practical higher level lang.
2.COBOL- Business oriented language
3.PASCAL - The teaching language
4.BASIC - the hobbiest's language
5.QuickBASIC - BASIC comes of age
6.Object oriented programming (C, PASCAL)
7.Next generation languages (Hypertalk, Visual BASIC)
II.Windows:
A.General Characteristics
1.GUI
2.Graphically based
3.Multiple ways to do things
4.User-driven
5.Device independance
6.Event oriented
7.Mouse is critical
8.Multi-tasking
B.Programming differences
DOS
Programmer in control...
User has few options
Computer 'trains' user
Programmer's job to anticipate user's wishes.
Procedural program design
Programmer directly responsible for all device control
User interface completely up to programmer
Generally easier to program, harder to use
WINDOWS
User in control
Object oriented program design
Device - independant control
Standardized user interface
Generally harder to program, easier to use
Getting to Visual Basic in the Lab
Get to main windows area
Show Applications window if necessary
Choose CSCI group by double-clicking on it.
Double-Click on Visual Basic 3.0
Double-Click on Microsoft Visual Basic icon
Minimize Program manager
Guided Tour of VB
Parts of the VB Editor
Menu bar
Tool Bar
Tool Box
Project Window
Properties Box
Using Menu bar to show, hide other components
Naming a form
Click on the form to 'select' it
Click on the properties box
Click on the Name property to select it.
You will probably have to scroll through a list
Highlight the editing part of the properties box.
Change the name to Myfirst
Notice that the object name in the properties box has changed
Also note that the caption (at the top of the form has not)
Use the same procedure to change the form's CAPTION property to
{your name}'s First VB program
(using your own name, of course!)
Examine other properties of the form, but do not change them randomly
Adding a picture box
Show the Toolbox if it is hidden
Click on the Picture box icon (the cactus picture)
Drag a small area on the form. This is your picture box
Change the shape of the box with the 'handles'
Change the background color of the box
Double-click on the BackColor icon
Choose a color for your box from the pallette
Change if you don't like the first
Add some code to the picture box
Double-click on the picture box. This will bring up the code window
First, decide the algorhythm
then implement it
Some concepts:
Object oriented syntax:
OBJECT.PROPERTY
sometimes FORM.OBJECT.PROPERTY
Note the periods and lack of spaces
Variable = Value
Read 'Variable gets value'
NOT equality
for our purposes tonight, an object property is a variable
Save the program:
TWO different files:
Form has .FRM extension
Contains description of form, its objects and code
Project has .MAK extension
essentially a list of the forms in the program
Use Disk icon on toolbar... Safest way to be sure everything is saved
Name FORM A:MYFIRST.FRM
Save Project as A:VB1.MAK
Look at the default name given and ALWAYS use the same extension
If you are confused about this, use NO extension at all.
VB will guess better than you.
Test the program
Press the Play button on the toolbar. You will see your program running
Click on the form outside the box. Nothing should happen
Click inside the box. The window should change colors.
If it worked, dance and sing. If not, curse. In either case, hit the stop button to return
Make at least two more boxes like the first one.
Save and test your program
Leave your program in the box at the front of the lab.
Return to the Syllabus.