CIS 230, Visual Basic
Ch. 1 Notes, page 1
Objective #1: Describe the process of visual program design and development.
- After you have read Ch. 1 and followed the textbook's exercises, use the information you
have learned to describe the process of visual program design and development. Contrast it
with any previous experiences that you may have had with programming languages such as
Pascal, COBOL, FORTRAN, or BASIC.
Objective #2: Explain the term event-driven programming.
- Visual Basic makes it easy to create event-driven programs. An
event-driven program is one which responds to users' actions especially mouse clicks and
mouse movement. Before widespread use of the desktop computer mouse in the late 1980's it
made little sense to create such programs. The user more control over the flow of the
program and the order of execution of different tasks. This places new demands on
programmers, however. It is important to design a practical and consistent environment
when writing VB programs.
some user events associated with a
- Formerly, programming languages such as older versions of Basic, Pascal, C, FORTRAN, and
COBOL were procedural. The programmer simply wrote lines of code that
executed with a sequential flow of control. The compiler or interpreter
determined the order of execution of different tasks based on the programmer's original
design. Such programs were not as interactive as modern VB event-driven ones. However,
sometimes user interactivity is a hindrance to effective program execution.
Objective #3: Explain the concepts of objects, properties, and methods.
- Objects are generally any thing that you introduce within a VB project.
Examples of objects include forms and controls. Forms are the building blocks of your
programs. A form is a window on which you place other objects. Sometimes a form can take
the form of a dialog box which you are accustomed to seeing in almost every Windows
program. Controls are the things that you place on top of forms. Controls include text
boxes, command buttons, list boxes, pictures, etc.
- Properties are associated with objects. Any single object has numerous
properties that affect the way it is displayed and the way that it interacts with the user
and other objects. Referring to properties is tricky. You must first include the name of
the object, followed by a period, and then the name of the property. For example, the
Caption property of a form called Form1 is referred to as Form1.Caption
- Methods are actions that a programmer can use with objects. For
example, printing an object such as a form is a method of that form. To print the form
named Form1, you also use the period symbol as in Form1.Print
Objective #4: List and describe the 3 steps for writing a Visual Basic project.
- You must always plan a program before you actually write it to be a successful
programmer. Many students and professionals overlook this crucial necessity.
- Design the user interface: You should storyboard the program by
actually drawing pictures of the screen that the user will interact with during the
program's execution. Show the forms and controls carefully and accurately. Do NOT assume
that you will be able to "figure it out" when you sit down to type the code into
the computer. It is highly recommended to name the forms and controls that you plan to use
beforehand rather than to write them into the code as you type it as well.
- Plan the properties: Since it is possible to highly customize the look
and feel of a VB program (unlike older procedural programs), it is very important to write
down your ideas and plans before typing the code into the computer. Your program will not
have a commercial and professional appearance, otherwise.
- Plan the code: Write out pseudocode that explains the
procedural tasks that must be accomplished within your program before typing or even
writing out actual Basic code. Pseudocode is English phrases that roughly explains how you
plan to do things within your program. Do not use Basic keywords or perfect syntax during
this planning phase.
Objective #5: Describe the various files that make up a Visual Basic project.
- Visual Basic programs can be called projects. VB is a more complicated programming
environment than older versions of Basic. The project consists of the following files:
- A .vbp file which is the project file. You rarely would have to edit
this file but you must be aware of its existence and placement.
- One or more .frm files which each refer to the form windows that the
user will see during program execution. This file contains references to the objects and
their properties that are located on the particular form. A form file is really called a
form module in VB.
- More advanced programs will also include .bas files. These files are
called standard code modules and contain external procedures that can be used by any form
within the project.
- Even more advanced programs may include .ocx files which contain custom
controls. Usually you will be able to write a program that only requires the
standard control set which is included with your version of VB. But you can purchase
sophisticated controls from third-party developers and use them within your project.
- A .vbw file is saved for each VB project that you create. Visual Basic
holds information necessary to execute the program here.
- VERY IMPORTANT: You must
always create a new folder to store all of a projects associated files before you begin
the project. Be sure to create the project within this folder so that you will be able to
find all of the necessary, associated files in the future. After creating a VB project,
you must be very careful if you have to move a form module or other file because this may
render your program unexecutable. Also, do not rename files after creating them unless you
know what you are doing.
Objective #6: Identify the elements in the Visual Basic environment.
- The form window is your basic environment on which you place
things that will be seen by the user.
- The project explorer window shows the filenames of all of the form
(.frm) and code (.bas) modules that are contained in your current project. You can think
of this window as showing your .vbp project file's contents.
- The properties window allows you to set any property of the object
which is currently selected (i.e. highlighted) in the form window.
- The form layout window simply shows the position of the form as it would appear on the
screen to the user. I usually close the form layout window while developing a VB program.
- The toolbox usually appears along the left edge of the screen. It
contains the tools that you use to place controls on a form. You can double click a tool
to cause a control to appear on the current form. You can also pass your mouse over each
tool to see its name appear in a pop-up window.
- The main Visual Basic window holds the menu bar (at the very top), the toolbar (just
under the menu bar), and form location and size info.
- The form location and size information appears at the right end of the toolbar and can
be useful for design reasons.
- The Help menu is a very useful and often overlooked repository of
information. Use the online Help to learn about Visual Basic!
Objective #7: Define design time, run time, and break time.
- Design time refers to the period of development in which you carefully
plan and design the user interface. You also write out the pseudocode and the actual code
during design time.
- When you are testing and debugging your program, you are in the midst of run
- If you experience an error that stops your program, you experience what is called break
Objective #8: Write, run, save, print, and modify your first Visual Basic
- Follow our textbook's guidance starting on p. 9 to create a VB project.
Objective #9: Identify compile errors, run-time errors, and logic errors.
- Good luck! More on this to come.
Objective #10: Look up Visual Basic topics in Help.
- Do not overlook this useful aspect of Visual Basic.
CIS 230 Home Page | Mr. Minich's Education Home Page | Minich.com Web Design
Minich.com Web Design