Learn the most popular programming language of the most popular Operating System: Windows

Ad

Writing and Running first Visual Basic Program

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.

Objectives

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:

  1. Understanding the concept of a Visual Basic project
  2. Learning how to manage Visual Basic projects
  3. Opening the Properties window and changing form properties
  4. Opening the Code window and writing Visual Basic instructions
  5. 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 inserteable 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.

Share:

No comments:

Post a Comment

Popular Posts

Search This Blog

Powered by Blogger.

Featured Post

Coded Statements and Methods

In the preceding procedure , you wrote several coded instructions, which introduced two different programming statements and a method: the D...

Recent Posts