The Project explorer window gives you a tree-structured view of all the files inserted into the application. You
can expand these and collapse branches of the views to get more or less detail (Project explorer). The project
explorer window displays forms, modules or other separators which are supported by the visual basic like
classes and Advanced Modules. If you want to select a form on its own simply double click on the project
explorer window for a more detailed look. And it will display it where the Default form is located.
Properties Window
The Properties Window is docked under the Project Explorer window. The Properties Window exposes the various
characteristics of selected objects. Each and every form in an application is considered an object. Now, each object in
Visual Basic has characteristics such as color and size. Other characteristics affect not just the appearance of the object
but the way it behaves too. All these characteristics of an object are called its properties. Thus, a form has properties and
any controls placed on it will have properties too. All of these properties are displayed in the Properties Window.
The Default Layout or Form Layout Window
When we start Visual Basic, we are provided with a VB project. A VB project is a collection of the following
modules and files.
The global module( that contains declaration and procedures)
The form module(that contains the graphic elements of the VB application along with the instruction )
The general module (that generally contains general-purpose instructions not pertaining to anything
graphic on-screen)
The class module(that contains the defining characteristics of a class, including its properties and
methods)
The resource files(that allows you to collect all of the texts and bitmaps for an application in one place)
On start up, Visual Basic will displays the following windows:
The Blank Form window
The Project window
The Properties window
It also includes a Toolbox that consists of all the controls essential for developing a VB Application. Controls
are tools such as boxes, buttons, labels and other objects draw on a form to get input or display output. They
also add visual appeal.
Tool box
You may have noticed that when you click on different controls the Properties Window changes slightly this is
due to different controls having different functions. Therefore more options are needed for example if you had a
picture then you want to show an image. But if you wanted to open a internet connection you would have to fill
in the remote host and other such settings. When you use the command ( ) you will find that a new set of
properties come up the following will provide a description and a property.
What an event is
The ‘look’ of a Visual Basic application is determined by what controls are used, but the ‘feel’ is determined by
the events. An event is something which can happen to a control. For example, a user can click on a button,
change a text box, or resize a form. As explained in Creating a Visual Basic Application, writing a program is
made up of three events: 1) select suitable controls, 2) set the properties, and 3) write the code. It is at the code
writing stage when it becomes important to choose appropriate events for each control. To do this double click
on the control the event will be used for, or click on the icon in the project window (usually top right of
screen). A code window should now be displayed similar to the one shown below.
The left hand dropdown box provides a list of all controls used by the current form, the form itself, and a special
section called General Declarations. The corresponding dropdown box on the right displays a list of all events
applicable to the current control (as specified by the left hand dropdown box). Events displayed in bold signify
that code has already been written for them, unbold events are unused. To demonstrate that different events can
play a significant role in determining the feel of an application, a small example program will be written to add
two numbers together and display the answer. The first solution to this problem will use the click event of a
command button, while the second will the change event of two text boxes.
Click Event
Before any events can be coded it is necessary to design the interface from suitable controls. As shown in the
screen shot below use: 2 text boxes to enter the numbers, a label for the ‘+’ sign, a command button for the ‘=’
sign, and another label for the answer.
Making the click event is very simple just select the button with the mouse and double click visual basic will
generate
You can see on the top right there is a 'click' dropdown list this is known as a event handler.
can expand these and collapse branches of the views to get more or less detail (Project explorer). The project
explorer window displays forms, modules or other separators which are supported by the visual basic like
classes and Advanced Modules. If you want to select a form on its own simply double click on the project
explorer window for a more detailed look. And it will display it where the Default form is located.
Properties Window
The Properties Window is docked under the Project Explorer window. The Properties Window exposes the various
characteristics of selected objects. Each and every form in an application is considered an object. Now, each object in
Visual Basic has characteristics such as color and size. Other characteristics affect not just the appearance of the object
but the way it behaves too. All these characteristics of an object are called its properties. Thus, a form has properties and
any controls placed on it will have properties too. All of these properties are displayed in the Properties Window.
The Default Layout or Form Layout Window
When we start Visual Basic, we are provided with a VB project. A VB project is a collection of the following
modules and files.
The global module( that contains declaration and procedures)
The form module(that contains the graphic elements of the VB application along with the instruction )
The general module (that generally contains general-purpose instructions not pertaining to anything
graphic on-screen)
The class module(that contains the defining characteristics of a class, including its properties and
methods)
The resource files(that allows you to collect all of the texts and bitmaps for an application in one place)
On start up, Visual Basic will displays the following windows:
The Blank Form window
The Project window
The Properties window
It also includes a Toolbox that consists of all the controls essential for developing a VB Application. Controls
are tools such as boxes, buttons, labels and other objects draw on a form to get input or display output. They
also add visual appeal.
Tool box
You may have noticed that when you click on different controls the Properties Window changes slightly this is
due to different controls having different functions. Therefore more options are needed for example if you had a
picture then you want to show an image. But if you wanted to open a internet connection you would have to fill
in the remote host and other such settings. When you use the command ( ) you will find that a new set of
properties come up the following will provide a description and a property.
What an event is
The ‘look’ of a Visual Basic application is determined by what controls are used, but the ‘feel’ is determined by
the events. An event is something which can happen to a control. For example, a user can click on a button,
change a text box, or resize a form. As explained in Creating a Visual Basic Application, writing a program is
made up of three events: 1) select suitable controls, 2) set the properties, and 3) write the code. It is at the code
writing stage when it becomes important to choose appropriate events for each control. To do this double click
on the control the event will be used for, or click on the icon in the project window (usually top right of
screen). A code window should now be displayed similar to the one shown below.
The left hand dropdown box provides a list of all controls used by the current form, the form itself, and a special
section called General Declarations. The corresponding dropdown box on the right displays a list of all events
applicable to the current control (as specified by the left hand dropdown box). Events displayed in bold signify
that code has already been written for them, unbold events are unused. To demonstrate that different events can
play a significant role in determining the feel of an application, a small example program will be written to add
two numbers together and display the answer. The first solution to this problem will use the click event of a
command button, while the second will the change event of two text boxes.
Click Event
Before any events can be coded it is necessary to design the interface from suitable controls. As shown in the
screen shot below use: 2 text boxes to enter the numbers, a label for the ‘+’ sign, a command button for the ‘=’
sign, and another label for the answer.
Making the click event is very simple just select the button with the mouse and double click visual basic will
generate
You can see on the top right there is a 'click' dropdown list this is known as a event handler.
No comments:
Post a Comment