Wednesday, January 9, 2013

The Visual Basic Programming Language


History:

Microsoft released Visual Basic in 1987. It was the first visual development tool from Microsoft, and it was to compete with C, C++, Pascal and other well-known programming languages. From the start, Visual Basic wasn't a hit. It wasn't until release 2.0 in 1991 that people really discovered the potential of the language, and with release 3.0 it had become the fastest-growing programming language on the market.

What Is Visual Basic?

Programmers have undergone a major change in many years of programming various machines. For example what could be created in minutes with Visual Basic could take days in other languages such: as "C" or "Pascal". Visual Basic provides many interesting sets of tools to aid you in building exciting applications. Visual Basic provides these tools to make your life far more easier because all the real hard code is already written for you.
With controls like these you can create many applications which use certain parts of windows. For example, one of the controls could be a button, which we have demonstrated in the "Hello World" program below. First create the control on the screen, then write the code which would be executed once the control button is pressed. With this sort of operation in mind, simple programs would take very little code. Why do it like the poor old "C" programmer who would have to write code to even display a window on the screen, when Visual Basic already has this part written for you.
Even though people tend to say Visual Basic's compiler is far behind the compilers of Pascal and C, it has earned itself the status of a professional programming language, and has almost freed BASIC of the reputation of a children's language. Overall you would class Visual Basic as a Graphics User Interface(GUI). Because as you draw, you write for the program. This must always be remembered in any kind of creation of a Visual Basic program. All in all, VB is the preferred language of many future program mers. If you want to start programming Windows, and don't know how to start, give Visual Basic a shot.

Significant Language Features

Visual Basic is not only a programming language, but also a complete graphical development environment. This environment allows users with little programming experience to quickly develop useful Microsoft Windows applications which have the ability to use OLE ( Object Linking and Embedding ) objects, such as an Excel spreadsheet. Visual Basic also has the ability to develop programs that can be used as a front end application to a database system, serving as the user interface which collects user input and displays formatted output in a more appealing and useful form than many SQL versions are capable of.
Visual Basic's main selling point is the ease with which it allows the user to create nice looking, graphical programs with little coding by the programmer, unlike many other languages that may take hundreds of lines of programmer keyed code. As the programmer works in the graphical environment, much of the program code is automatically generated by the Visual Basic program. In order to understand how this happens it is necessary to understand the major concepts, objects and tools used by Visual Basic. The main object in Visual Basic is called a form. When you open a new project, you will start with a clear form that looks similar to this :


This form will eventually be incorporated into your program as a window. To this form you add controls. Controls are things like text boxes, check boxes and command buttons. Controls are added to your form by choosing them from the Visual Basic "tool box" with the mouse and inserting them in the form. Yours may look different, but the basic Visual Basic Tool Box looks like this :


Once forms/controls are created, you can change the properties ( appearance, structure etc. ) related to those objects in that particular objects properties window. From this window, you choose the property you want to change from the list and change its corresponding setting. Here is an example of a properties window :

Finally, you can add events to your controls. Events are responses to actions performed on controls. For example, in the "Hello world" program sample on this page, when you click on the command button on our form the event that is triggered is the output of the message "Hello world" to the screen. Code must be written to create an event. You can do this in Visual Basic's code window. Yours will look similar to this ( except of course, the body of the sub-procedure where the actions are specified) :

Areas of Application:

The term "Personal Programming" refers to the idea that, wherever you work, whatever you do, you can expand your computer's usefulness by writing applications to use in your own job. Personal Programming is what Visual Basic is all about.
Using Visual Basic's tools, you quickly translate an abstract idea into a program design you can actually see on the screen. VB encourages you to experiment, revise, correct, and network your design until the new project meets your requirements. However , most of all, it inspires your imagination and creativity.
Visual Basic is ideal for developing applications that run in the new Windows 95 operating system. VB presents a 3-step approach for creating programs:
  1. Design the appearance of your application.
  2. Assign property settings to the objects of your program.
  3. Write the code to direct specific tasks at runtime.

Visual Basic can and is used in a number of different areas, for example:
  • Eucation
  • Research
  • Medecine
  • Business
  • Commerce
  • Marketing and Sales
  • Accounting
  • Consulting
  • Law
  • Science

Sample Programs:

Hello World! Example Program:

Description

This program demonstrates the text output and button control functions of the Visual Basic programming language. By clicking on the button "Hello World", the message "Hello world" is displayed in the upper left hand corner.

Source Code

Visual Basic


VERSION 4.00
Begin VB.Form Form1 
   Caption         =   "Hello"
   ClientHeight    =   6030
   ClientLeft      =   1095
   ClientTop       =   1515
   ClientWidth     =   6720
   Height          =   6435
   Left            =   1035
   LinkTopic       =   "Form1"
   ScaleHeight     =   6030
   ScaleWidth      =   6720
   Top             =   1170
   Width           =   6840
   Begin VB.CommandButton Command1 
      Caption         =   "Hello World"
      Height          =   975
      Left            =   2040
      TabIndex        =   0
      Top             =   2280
      Width           =   2535
   End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub Command1_Click()
Cls
Print "Hello World"
End Sub

  • Sample Run




0 comments:

Post a Comment

Powered by Blogger.