Visual Basic

Visual Basic Classic [ vɪʒʊəl beɪsɪk ] (abbr. VB) is a proprietary object-oriented programming language. To distinguish between the old, only object-based, and the new, based on the. NET Framework versions, the former are up to and including Visual Basic 6.0 and Visual Basic Classic, the latter, however, as Visual Basic. NET ( VB.NET Abbr ) referred to. This article deals with Visual Basic Classic.

  • 5.1 Syntax Visual Basic Classic


The historically most important advantage of BASIC is easy to learn the language. The language is intended to resemble the English language and uses words instead of symbols. Examples are And instead of &&, Or instead of | |, mod instead of%, as in C standard.

Because Visual Basic was designed from the outset for use with an integrated development environment, Visual Basic programs can be usually created in a short time. This makes it ideal for rapid application development. Visual Basic Classic, which had not yet been the object-oriented capabilities of VB.NET, has often been used to build the first prototypes for programs that were implemented later, for example, in C . The special feature was the creation of graphical user interfaces, what was offered at the time of the appearance of only a few programming environments.

Visual Basic is extremely well documented. The MSDN Library is one of the largest (delivered on three CDs / 1 DVD) collections of information for programmers.

Visual Basic supports both static and dynamic typing via the " Variant " data type.


In the early 1990s BASIC, which was then included with many operating systems had, compared to other high-level languages ​​such as C and C diminished. BASIC offered a much more limited functionality and expandability, which it was not suitable for professional use.

The later historical success of Visual Basic is mainly due to the ease of learning, visual development environments and the ease of expandability of the associated libraries. Critics bemoan the lack of functionality. Often also slow execution speeds on low end computers ( usually only during interpretation) the speech, however, which is negligible in modern computers after translation today.

1991: Visual Basic and Visual Basic for DOS 1 - The Beginnings

The Microsoft Company, whose history began developing a BASIC interpreter, joined in 1991 their QuickBasic compiler with an environment for interactive design of user interfaces. This environment ( sometimes referred to as the "father" of Visual Basic called ) goes back to Alan Cooper, allowed for the first time, quickly and easily create applications for Windows.

The source code for Visual Basic - 1 programs has been interpreted, that is, the source code during the execution (ie at runtime) processed. The translation program with the generated files (EXE ) file did not contain directly executable machine code, but the so-called P- code. To perform therefore always a separate runtime library needed to be included. This is true even for versions 5 and 6 of Visual Basic which can generate native code.

Visual Basic for Windows seemed to Visual Basic for MS- DOS (abbr. " VBDOS " ) on the market. VBDOS based more on its predecessors, Microsoft BASIC PDS or QuickBASIC and corresponding source code could be processed immediately. VBDOS produced programs for running under DOS ( and thereby also its own executable files without an additional runtime library ), but not Windows programs. While the Windows version of Visual Basic had a graphical user interface and also could display bitmaps, VBDOS running in text mode and formed a quasi- graphical user interface of ASCII characters. VBDOS was not as successful as the version for Windows, so there was never a follow-up version.

With Visual Basic, the strategy of different versions has been introduced. Before corresponded QuickBasic the "Standard Edition" and BASIC PDS of the "Professional Edition". It contained example programs, demonstrating the integration of a help system supporting Windows fonts and the use of presentation graphics, for example.

1992-1993: Visual Basic 2-3 - Integration of the development process

With the published only under Windows subsequent versions " Visual Basic 2 " (1992) and " Visual Basic 3" ( 1993) were primarily extensions of language and implemented the development environment. Among other objects were introduced. Starting with Visual Basic 2 also called auxiliary control elements (controls ) of type VBX (Visual Basic Extensions) were supported, with which foreign manufacturers or other C programmers could extend the functionality of Visual Basic, and were an important factor in the success of Visual Basic.

1996-1998: Visual Basic 4-6 - 32 bit and COM

The published after a long break in 1996, Visual Basic 4, it was the first time not only in a 16- bit version for Windows systems up to version 3.1, but also as a 32 -bit version, with the one for Windows NT and Windows 95 could create optimized programs. The jump from 16 to 32 bits followed in the following year, the next big innovation: Visual Basic 5 programs were first compiled into machine code. So it was - in contrast to the previous versions - no longer possible to extract the source code of Visual Basic programs from the executable file. In addition, a significant performance gain arose. Through these innovations, Visual Basic 5 was suitable for the first time to create time-critical applications. Nevertheless Visual Basic programs were still slower than about C programs.

With Visual Basic 4, 5 and 6 (1998 ) of the language have been added object-oriented elements, but without fulfilling all the criteria of object-oriented programming. Visual Basic 6 was the last Visual Basic version, which allowed for the creation of native Win32 programs.

Visual Basic 4 advanced the concept of " Standard Edition " and "Professional Edition" to the "Enterprise Edition". With Visual Basic 5 is also a " Control Creation Edition" (CCE ) was published, which was free, but in principle only to create controls ( ActiveX controls, OCX ) could be used.

Embedded Visual Basic ( eVB )

For the development of Windows Mobile / Windows CE applications there was a special version called Embedded Visual Basic. They resembled strengthens the classic VB and was discontinued with the release of VB.NET. Until Windows Mobile 2003 the necessary run-time library was part of the operating system later this could be installed separately.


Due to its popularity and ease of learning Visual Basic Classic Microsoft has been adapted for various specific environments.

Visual Basic Script

Visual Basic Script ( VBScript or VBS short ) is an interpreted Visual Basic variant, which is used to create dynamic web pages or smaller scripts. The language uses the same syntax as Visual Basic Classic. Surfaces can not be directly, but only indirectly created by embedding the VBScript code in HTML using the Windows Scripting Host. This VBS can access all COM objects with IDispatch interface. VBS was except for Windows - and client-side web scripts used for server-side web scripts in an ASP environment. With ASP.NET, VBS, however, was displaced by VB.NET.

Visual Basic for Applications

Visual Basic for Applications ( VBA short ) is also a rating based on Visual Basic Classic interpreted scripting language. It has been designed to automate repetitive tasks within other programs and has great popularity attained, since it delivers Microsoft Office program with his office. About the oldest VBA connections have Microsoft Excel, Microsoft Access (both since 1995) and Microsoft Word ( since 1997). Also VBA competes with. NET because Visual Studio. NET is shipped with the Visual Studio Tools for Applications (formerly Visual Studio Tools for Office ), accept a similar function to VBA.

Development environments

The ( historically ) most popular integrated development environment for Visual Basic is "Microsoft Visual Basic" to which there was no alternative.

Syntax Examples

To allow comparison, all of the following programs serve the same purpose: to provide everyone an alert box with the content from "Hello world! ".

Syntax of Visual Basic Classic

The syntax of Visual Basic Classic is similar to its predecessor, QuickBasic. This example contains the start Main function of the program. The MsgBox command creates the message box.

Sub Main ()      MsgBox " Hello world!" end Sub Legal Aspects

Visual Basic Classic, unlike many modern high-level languages ​​, not an open standard, but proprietary and intellectual property of Microsoft.