Last week you have learned how to run a program that had been made for you. You probably noticed that when working with Visual Basic, several types of windows could be inspected – even though you were not asked to examine any one window in detail. Here, you learn about three types of windows:
- Project window
- Properties window
- Code window
You will learn how to move from one window to the next in writing a Visual Basic program. Also, you will write and run several simple Visual Basic programs.
In working through the next few exercises you will master a number of new tasks, including how to
- open a new project;
- save a project;
- name a form and project;
- remove a form from a project;
- add a form to a project;
- print a form, form text, and code;
- write a click() procedure;
- write a KeyPress() procedure;
- change font size, style and type;
- change the window state.
The tasks for this chapter are distilled into five objectives that teach you the fundamentals of writing and running a Visual Basic program, as follows:
- Understanding the concept of a Visual Basic project
- Learning how to manage Visual Basic projects
- Opening the Properties window and changing form properties
- Opening the Code window and writing Visual Basic instructions
- Producing a compiled application from a Standard EXE project
Understanding the Concept of a Visual Basic Project
Every Visual Basic application is defined and saved as a project. Each project, in turn, consists of a collection of files. These files can include modules, insertable objects, and a single resource file. Projects themselves are tracked by a project file, which has a .VBP extension.
Form modules, as discussed earlier are first seen as windows with a caption, but Form modules contain coded instructions called procedures for the form itself and for the controls and insertable objects placed on the form. Other modules include standard modules and class modules. You will learn the differences among these types of modules as you progress.
The tools of the toolbox represent controls and insertable objects. The toolbox can be made visible or invisible by choosing View, Toolbox. When visible, the toolbox contains a set of icons – each representing a standard or a custom control. A visual Basic project always includes a set of standard controls and can also include custom controls. Each custom control has an .OCX extension. You will be asked to write some beginning Visual Basic procedures for forms. In “Adding Controls and Event Procedures to Form MOdules,” you will add procedures for standard controls.
Projects can also include a resource file, which can contain either binary data, such as images and sounds, or string data. Resource files need to be created by a Windows resource compiler (typically a C or C++ language compiler), or you can use the resource compiler bundled with Visual Basic.
Secondary Storage Device