Wednesday 24 June 2009

Working with projects and controls in VB6

A VB project contains one or more forms and/or modules which make up a complete VB application. By default, VB names the project "Project1", but you can rename the project by going to Project à Project1 Properties on the VB menu, which will open the following dialog box:
On the General tab of the Project Properties dialog box, let's change the name from "Project1" to prjFirst. When you are done, click OK to dismiss the dialog box.

Now that we have the IDE just the way we want it and a proper project name to work under, let's explore the basic windows that comprise the VB IDE.

The Form

The form is the heart of your VB application; it is the "screen" or "window" that your users will interact with. You can think of the form as a "canvas" on which you will place the various objects that make up your application. When you start a new project, VB automatically supplies you with one form to work with; more forms can be added as needed (the first few examples in this manual will only use one form). Before we start adding objects to the form, let's set some of its properties, using the Properties window.

The Properties Window

The Properties window lets you change the characteristics, or property settings, of the form itself and of visual interface elements on the form. The Properties window consists of two columns: the first is the name of the property, which you cannot change; the second column, which is the property setting that you can change.

Make sure the form is the active window (click on its title bar if necessary), then locate the Properties window. On the Properties window, change the (Name) property to frmFirst, as shown below:


VB objects are automatically given a "numeric name" (like "Form1", "Form2", etc.). It is good programming practice to rename these objects to something more meaningful.

Change the Caption property to My First Program:


Note that the title bar of the form changes accordingly:



The Toolbox

The toolbox (shown below), consists of the various objects that you will use to design your application. These objects, called controls, are objects that you see in all standard Windows applications, such as textboxes, command buttons, option (radio) buttons, checkboxes, etc.


No comments:

Post a Comment