Ask a Teacher



Explain about VB(Visual Basic..

VISUAL BASIC

VISUAL BASIC is a high level programming language which  evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-purposeSymbolic Instruction Code. It is a very  easy programming language to learn. The code look a lot  like English Language. Different software companies produced different versions of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC ,IBM BASICA and so on. However, people prefer to use Microsoft Visual Basic today, as it is a well developed programming language and supporting resources are available everywhere. Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than Visual Basic 6. We also have VB.net, VB2005, VB2008 and the latest VB2010. Both Vb2008 and VB2010 are fully object oriented programming (OOP) language.
VISUAL BASIC is a VISUAL and  events driven Programming Language. In BASIC, programming is done in a text-only environment and the program is executed sequentially. In VB, programming is done in a graphical environment. In the old BASIC, you have to write program code for each graphical object you wish to display it on screen, including its position and its color. However, In VB , you just need to drag and drop any graphical object anywhere on the form, and you can change its color any time using the properties windows.

On start up, Visual Basic 6.0  will display the following dialog box as shown in



You can choose to either start a new project, open an existing project or select a list of recently opened programs.

A project is a collection of files that make up your application. There are various types of applications that we could create, however, we shall concentrate on creating Standard EXE programs (EXE means executable program). Now, click on the Standard EXE icon to go into the actual Visual Basic 6 programming environment.


The Visual Basic Integrated Development Environment

Visual Basic is a high level programming paradigm. Its concepts are based upon Event driven programming. The environment to edit, delete and write code as well as develop windows based applications is known as the 'Integrated Development Environment' (IDE).

The development environment for Visual Basic is illustrated below in figure



From the diagram it can be seen that the IDE is divided into separate areas or 'windows'. We have the Toolbox control which allows us to add objects on to Form window. We can change the properties using the properties windows for all the objects on the form. We can also edit/create the event handlers using the Code Window. When creating applications in Visual Basic it is quite common to use multiple forms, modules etc. The project explorer window is used to keep track of all the additional files used.

The Toolbar

Visual Basic supports multiple toolbars which are split into three main areas
  • Standard toolbar
  • Edit toolbar
  • Debug toolbar
You are able to customise the toolbar by clicking the right mouse button of the toolbar and selecting <Customize> and changing the options you require. The diagram and components of the standard toolbar are illustrated below:


The Toolbox

The diagram below shows the main tools that appear on the standard Toolbox window. These are called the intrinsic controls because all three editions of VB support these standard tools. You can add additional controls to the toolbox as your needs grow. Some extra tools come with all three editions of VB, but these extra tools do not appear on the Toolbox window until you add them through the <Project | Components> menu option.


Pointer :   For resizing forms and controls (a tool for selection and manipulation of objects
Label    :   For changing text such as captions
Frames  :  Purely visual effect (used to group check boxes or option buttons
Check Box :   For binary options
Combo Box :   Combination of list box and text box
Timers  :       Can be used to control animations or timing events (often invisible)
Picture Boxes :   Allows the inclusion of bitmaps, icons on a form
Text Boxes   : Provide a standard way for accepting user input through the keyboard
Command Button  : Standard Window command buttons such as 'OK' and 'Cancel'.

All standard components of Windows interfaces can be created here. The Toolbox is selected by choosing Toolbox menu from the View menu.

The Form Window

The Form window is your primary work area where the visual development of the application is created or modified. Although the Form window first appears small relative to the rest of the screen, the Form window comprises the background of the application.

 
The form window shows the main body of the application. The form can be resized to take up the width of the screen. Here objects are placed on to the form such as the command buttons, labels, text boxes, scrollbars, and other controls to form the main elements of the Graphical User Interface.

The Code Window

The Form window holds the program's interactive objects, to view the code for the Form window or any object we can Select <View | Code >. The Code window is little more than a text editor with which you write the programming statements that tie the application together.


An alternative technique to view the code is to double click anywhere on the form or the object and view the code for that particular object. The diagram shows the Code Window for the form.
   
Source program is code, forms, menus, graphics, and help files that you create and edit to form the project (also called source code).

The parts of the application that you create, such as the forms, the code, and the graphics that you prepare for output, comprise the source program. The code listing below gives an example of code that is incorporated in a typical application:

  Private Sub txtJAN_KeyPress(KeyAscii As Integer)
  Call TEST(KeyAscii, txtFEB)
  End Sub

The form window shows the main body of the application. The form can be resized to take up the width of the screen. Here objects are placed on to the form such as the command buttons, labels, text boxes, scrollbars, and other controls to form the main elements of the Graphical User Interface.

The Project Explorer Window


The Project Explorer window, often called the Project window, gives you a tree-structured view of all the files in the application.


The Project Explorer was used to celebrate the resemblance of the window to the typical Explorer-like tree-structured file views so prevalent in Windows 95 and 98/2000. You can expand and collapse branches of the view to get more or less detail.

The Project Explorer window displays forms, modules (files that hold supporting code for the application), classes (advanced modules), and more. When you want to work with a particular part of the loaded application, double-click the component in the Project window to bring that component into focus.

The Properties Window

The property window represents an objects associated properties. Each property of a control such as a Label, command button etc. has its own unique set of properties.

   
A different list appears in the Properties window every time you click over a different Form window object. The Properties window describes properties (descriptive and functional information) about the form and its controls. Many properties exist for almost every object in Visual Basic. The Properties window lists all the properties of the Form window's selected control.

Running the Application

To run the application

F5











comments powered by Disqus