Visual Basic .NET Is More Than Visual Basic 6 1

Part I

Introduction to Upgrading

Chapter 1

Visual Basic .NET Is More Than Visual Basic 6 + 1

If you re familiar with Visual Basic but aren t familiar with Visual Basic .NET, you may be wondering why we have written a book on upgrading. Surely Visual Basic .NET will open Visual Basic 6 projects as effortlessly as Visual Basic 6 opens Visual Basic 5 projects. How different can Visual Basic .NET be? you might ask. So before we start discussing the details of upgrading, let s clear up any confusion: Visual Basic .NET, the latest version of Visual Basic, is not merely Visual Basic 6 with a few new features added on. Instead, Visual Basic has been thoroughly redesigned and restructured. The language has been modernized, with new, richer object models for data, forms, transactions, and almost everything else. The file formats have also changed.

Unfortunately, these changes mean that Visual Basic .NET is not entirely backward compatible with Visual Basic 6. Projects from previous versions need to be upgraded before they will compile and run in Visual Basic .NET. The Upgrade Wizard handles much of this work for you, but most real-world projects will require additional modifications before they can be run. Some people consider moving applications from Visual Basic 6 to .NET to be a migration rather than an upgrade, but the changes in the language are a logical step, and they make Visual Basic more powerful than ever before.

This is an exciting time for Visual Basic developers. Sure, upgrading applications takes some effort, but on the other hand Visual Basic .NET is incredibly capable, extending Visual Basic s Rapid Application Development (RAD) model to the server and to the Web. Visual Basic .NET adds more features to Visual Basic than did Visual Basic 2, 3, 4, 5, and 6 combined. Microsoft made the changes because the focus of the language has shifted from previous versions. Whereas Visual Basic 6 was primarily a Windows development tool, Visual Basic .NET is designed to leverage the .NET platform, enabling the user to create Windows applications, console applications, class libraries, NT services, Web Forms applications, and XML Web services all while allowing seamless integration with other programming languages.

Let s look a little deeper at Visual Basic .NET to see where it differs from Visual Basic 6. We will look at the following three issues:

  • The development environment

  • The syntax of the language and object models of the classes

  • The run-time behavior of the compiled components

In each of these three areas, Visual Basic .NET departs from the conventions of Visual Basic 6. First, the integrated development environment (IDE) has been redesigned to house all of the Visual Studio languages: Visual Basic, C#, and Visual C++. Second, the language itself has been modernized, removing some keywords, such as GoSub; adding new keywords, like Inherits; and changing the meaning of other keywords, like Return and Integer. Finally, the run-time behavior of the compiled components is different. .NET applications are free-threaded; Visual Basic .NET projects are compiled to assemblies rather than to familiar Win32 applications, and variables and objects are garbage-collected, meaning that they lack a deterministic lifetime. A noticeable effect of this last change is that the class Finalize event is not triggered until sometime after the object is actually destroyed. We will talk more about these differences and about what .NET is in Chapter 2. For now, let s continue to look at what the changes mean to the Visual Basic developer.

With so much that is new, how familiar will it all be to traditional Visual Basic users? To what extent can you leverage your existing Visual Basic skills when you move to Visual Basic .NET? To answer these questions, let s take a quick look at the history of Visual Basic.

In 1991, Microsoft released Visual Basic 1, which opened the doors to Windows RAD. Visual Basic 1 was an instant success, and it s easy to see why. Before Visual Basic, developers had to write WndProc handlers, work with pointers, and know when to apply the Pascal calling convention to methods. Visual Basic took over the handling of all of these details, allowing developers to concentrate on building business objects instead of writing the basic plumbing in every program.

In Visual Basic versions 2 though 6, Microsoft kept the underlying architecture of the product the same and simply added new features. Visual Basic 2 and 3 introduced the property grid, Data Access Objects (DAO) database programming, and object linking and embedding (OLE), resulting in a great set of features for Windows 3.1 programming. In 1995, Microsoft released Visual Basic 4, which enabled developers to write 32-bit EXEs, ActiveX controls, and class libraries. The year 1995 also saw the explosion of the Internet, and people began wanting to build Web sites. With versions 5 and 6, Visual Basic added its own flavor of Web development WebClasses, ActiveX documents, and Dynamic HTML (DHTML) pages yet for the most part, it still remained a Windows development tool.

It s interesting to compare Visual Basic 1 with Visual Basic 6 to see how far the language has come. Visual Basic 1 had no IntelliSense, no support for open database connectivity (ODBC), no classes, limited debugging, no support for COM components, no Property Browser, no Web development features, and it created only EXEs. Visual Basic 6 had come a long way from the basic forms and modules development of version 1, yet it still had the spirit of Visual Basic. Visual Basic .NET also has that spirit: It has the same human-readable language, case insensitivity, support for late binding, automatic coercions, and familiar Visual Basic keywords, functions, and constructs, like Left$, MsgBox, and On Error GoTo. If you re a Visual Basic 6 programmer, it s a comfortable step to Visual Basic .NET. Yes, there are new concepts to learn, but your existing knowledge of Visual Basic is a great foundation.

After the release of Visual Basic 6, Microsoft was faced with a challenge. Developer needs were changing. More and more programmers were developing for the Web, and the Web development capabilities built into Visual Basic 6 were not addressing their needs. Visual Basic s DHTML pages and ActiveX documents were client-side technologies, meaning that both the component and the Visual Basic runtime had to be installed on client machines. Visual Basic s WebClasses, a server-based technology, stored state on the server and wasn t scalable. In addition, the design experience for both WebClasses and DHTML pages could only be described as rudimentary! In short, the technologies were too limiting. Internet developers wanted thin clients, not Visual Basic downloads. They wanted code that ran on the server. They wanted security, and they needed scalability, since the more successful a Web site was, the more people would use it concurrently, and therefore the more capacity it had to have.

Clearly, a better architecture was needed. Programmers had also been asking for some significant new language features: inheritance, easier access to the underlying platform, and a solution for the many different component versioning problems that had collectively been labeled DLL hell. When looking for a solution to these problems, Microsoft also saw the opportunity to create a unified framework for developing applications. To understand why such a framework was desirable, consider that developers wanting to create forms for Windows in Visual Basic 6, Visual C++, and Microsoft Office Visual Basic for Applications (VBA) had to learn a different forms package for each language. If only there was a common forms package for all these products. Life would be so much simpler! This objective and others led Microsoft to develop a common framework available to all .NET languages.

One side effect of giving all languages access to a common framework is that each language must support the same data types. This support prevents the sort of headaches familiar to anyone who has tried to use Windows APIs from Visual Basic 6. Once all languages support the same data types, it s simple to add cross-language interoperability: inheritance, debugging, security access, and an integrated compilation process. As you can see, the benefits of such a system would be amazing and that system is exactly what the .NET platform is: a multiple-language system with a common forms package, set of base classes, and data types. For Visual Basic to be part of this revolution meant more than just changing the language it meant reconceptualizing it from the ground up for the .NET platform.



Upgrading Microsoft Visual Basic 6.0to Microsoft Visual Basic  .NET
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET w/accompanying CD-ROM
ISBN: 073561587X
EAN: 2147483647
Year: 2001
Pages: 179

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