A QUICK OVERVIEW OF VISUAL BASIC


Visual Basic is visual because of the process that programmers go through to create the part of the application that users see, also known as the GUI (graphical user interface). Visual Basic is Basic because it was created based on the BASIC (Beginners All-Purpose Symbolic Instruction Code) programming language.

Visual Basic is a programming language that is used to develop Windows applications. This means that once you have written a Visual Basic application and compiled it into executable code, the application can run on its own. It doesn't require anything else to execute except for the Windows operating system.

Right from its initial release by Microsoft, Visual Basic earned a reputation for being very easy to learn while simultaneously delivering development capabilities previously only made available by more complex programming languages. As a result, it quickly became the most popular programming language in the world. Today, you'll find that Visual Basic is taught in colleges all over the world. It is also used by companies internationally to create Windows applications that drive mission-critical business processes.

image from book
DEFINITION

Compiling is the process of translating the code statements that make up a computer application into a format that can be executed by the computer operating system.

image from book

There are a number of reasons why Visual Basic is so popular. Three of the most important reasons include its support of the following:

  • Drag-and-drop GUI design

  • Rapid application development

  • Object-oriented programming

GUI Development

One of the first things that you will come to appreciate about Visual Basic as you work your way through this book is the ease with which it enables you to create a really slick looking GUI. When you first begin working on a Windows application, Visual Basic automatically creates a new blank window for you. It also provides you with a collection of Windows components, such as buttons, check boxes, and text boxes, that you can then add to the window by clicking on and dragging them over to the window and placing them where you want them.

image from book
DEFINITION

A GUI (graphical user interface) is the part of the application that the user sees and can interact with using the mouse.

image from book

Rapid Application Development

Visual Basic is a RAD (rapid application development) Windows application tool. RAD allows you to quickly create a mockup of your application so that you can show users what the application will look like even thought it lacks the underlying code that actually makes it work. This allows users to provide early feedback and helps programmers to deliver a final product that meets user expectations.

image from book
DEFINITION

RAD (rapid application development) is a process whereby programmers quickly create a mockup of an apptication's GUI for initial review by the users for whom the application is intended in order to demonstrate how the application will ultimately look and operate.

image from book

Object-Oriented Programming

Visual Basic is also an object-oriented programming (OOP) language. OOP refers to the coding part of creating a Visual Basic application as opposed to the development of its GUI. From an OOP perspective, everything in a Visual Basic application is treated like an object. Objects store information about themselves and provide access to this information. Objects also provide the ability to perform tasks and react to events. For example, in Visual Basic, a button is an object. Any information about a button is stored alongside the button, such as its size, color, and what actions the button initiates if it gets clicked. As you will learn in Chapter 9, "Getting Comfortable with Object-Oriented Programming," OOP supports code sharing and reuse and can greatly simplify program development.

image from book
DEFINITION

OOP (object oriented programming) is a methodology that combines the storage of information along with predefined program code that can be used to interact with the object and its information.

image from book

A Little Visual Basic History Lesson

Microsoft introduced Visual Basic version 1.0 in 1991. Up until this time, the only programming language available to programmers for Windows application development was Microsoft C. Microsoft C was powerful for sure, but it took a lot of time to master. In addition, it was not easy to use. In fact, it used to take many hundreds of lines of complex code statements to accomplish things that you can do with Visual Basic today with just a few lines of code.

Like all initial releases of new programming languages, the first version of Visual Basic had plenty of bugs. Things began to get a lot better when Microsoft released Visual Basic version 3.0. Version 3.0 also introduced built-in support for database access.

Visual Basic 4.0 appeared in 1995, creating a major impact on the programming world and solidifying Visual Basic's place as a major application development tool. Visual Basic 5.0 came next, adding support for OOP. Visual Basic 6.0 then came along, adding support for ActiveX data objects, expanding Visual Basic's database capabilities and making Internet database access possible.

Although it was a little slow in anticipating the way the Internet was changing the world, Microsoft decided that the Internet was a critical part of Visual Basic's future. At the same time, Microsoft wanted to create an application development environment that would support multiple programming languages (which it accomplished through the development of the .NET Framework). So Microsoft went back to the drawing board and completely redesigned the way Visual Basic worked from the bottom up. The end result was something totally new, Visual Basic .NET 2002. With the release of Visual Basic .NET 2002, Web development became as integral a part of Visual Basic as Windows development.

Visual Basic .NET 2002 was really a totally new version of Visual Basic. Microsoft literally started over when it built this version. As a result, there was no intention of providing for backward compatibility with Visual Basic 6.0 or any previous version of Visual Basic. Therefore, Visual Basic programmers could not automatically upgrade their applications from Visual Basic 6.0. This confused a large portion of the Visual Basic community, which had invested years and effort and a lot of money in projects based on Visual Basic 6.0.

image from book
IN THE REAL WORLD

Because of its popularity, Visual Basic 6.0 will still be with us for a long time. So many large projects were developed using it, and the cost of rewriting these projects is steep. If you visit http://msdn.microsoft.com/vbasic, Microsoft's Visual Basic Developer Center Web site, you'll see that Microsoft still supports and provides regular updates for Visual Basic 6.0.

image from book

Trap 

Microsoft did include a code migration tool with Visual Basic .NET 2002, which automatically launched any time a Visual Basic 6.0 program was loaded. Unfortunately, the migration tool was only capable of upgrading relatively simple programs.

In 2003, Microsoft updated Visual Basic .NET, releasing the next version as Visual Basic .NET 2003. This version added support for program development on mobile Web appliances such as PDAs and smart devices such as the Pocket PC. Improvements were also made to Web services and to the code migration process.

Finally, in 2005, Microsoft released Visual Basic .NET 2005. In addition to fixing a few bugs left in the previous version of Visual Basic .NET, Visual Basic .NET 2005 made significant enhancements to the language's Web development capabilities. Microsoft also introduced Visual Basic 2005 Express in 2005 in an effort to attract a new generation of programmers.

Trap 

In order to run an application created using Visual Basic .NET, a computer must have the .NET Framework installed on it. Microsoft has upgraded the .NET Framework several times since its introduction. Visual Basic .NET 2002 was designed to work with Microsoft .NET Framework 1.0. Visual Basic .NET 2003 was designed to work with Microsoft .NET Framework 1.1, and Visual Basic .NET 2005 works with Microsoft .NET 2.0. Although an application created using Visual Basic .NET 2002 will run on any computer that has any version of .NET installed on it, an application written using Visual Basic .NET 2003 requires that .NET 1.1 or 2.0 be installed. In similar fashion, an application written using Visual Basic .NET 2005 requires that .NET 2.0 is installed.

Visual Basic's Cousins

Visual Basic is just one of three computer programming languages developed by Microsoft based on the Basic programming language. The other two languages include:

  • VBA (Visual Basic for Applications)

  • VBScript

Microsoft created Visual Basic first and then created these other two languages in large part by extracting functionality from Visual Basic. As a result, once you have mastered the ability to create Visual Basic applications, you shouldn't have any trouble leveraging what you have learned when learning how to program with these other languages. A brief overview of VBA and VBScript is provided in the next two sections to give you an idea of the differences between Visual Basic and these two close cousins.

VBA

Microsoft introduced VBA in 1993. The current version of VBA is version 6.3, which Microsoft released in 2001. VBA is designed to provide applications with a Visual Basic-like programming language. Microsoft has embedded support for VBA into numerous Microsoft products, including:

  • Microsoft Word

  • Microsoft Excel

  • Microsoft Access

  • Microsoft PowerPoint

  • Microsoft FrontPage

  • Microsoft Outlook

For example, using VBA for Microsoft Access, Access programmers can create entire applications to automate application features provided by Microsoft Access. Unlike Visual Basic applications, which can be compiled into standalone programs that can be run directly from the Windows desktop, VBA applications require a host application such as Microsoft Access in order to run.

Hint 

To find out more about VBA and Microsoft Access, read Microsoft Access VBA Programming for the Absolute Beginner by Michael Vine, ISBN 1592000398.

Hint 

To find out more about VBA and Microsoft Excel, read Microsoft Excel VBA Programming for the Absolute Beginner by Duane Birnbaum, ISBN 1931841047.

VBScript

VBScript is a scripting language. In order to execute, VBScripts need to be executed by an execution host. Examples of execution hosts that support VBScript execution include Internet Explorer and the WSH (Windows Script Host). Execution hosts provide scripts with an environment in which they can execute as well as access to resources that exist within that environment. For example, VBScripts can be embedded within HTML pages and executed within the Internet Explorer Web browser. In addition to running embedded VBScripts, the browser provides the scripts with access to browser and Web page resources such as frames, buttons, and browser controls. By embedding VBScripts inside HTML pages, Web programmers can make their Web pages more dynamic by writing scripts that can create rollover effects, create cookies, generate pop-up dialogs, and so on.

Similarly, VBScripts that execute under the control of the WSH allow script developers to automate a host of Windows desktop tasks, including the creation of user accounts, desktop shortcuts, printer management, and so on. WSH-run VBScripts can even modify the Windows registry and control network resources such as network drives and printers.




Microsoft Visual Basic 2005 Express Edition Programming for the Absolute Beginner
Microsoft Visual Basic 2005 Express Edition Programming for the Absolute Beginner
ISBN: 1592008143
EAN: 2147483647
Year: 2006
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net