It's Time for VB6+
VB.NET is the way of the future, but Microsoft should provide developers with a VB6+ to ease the transition.
- By Bill McCarthy
VB.NET has progressed significantly as a tool for creating client and server applications since Microsoft released the initial version almost two years ago. ASP.NET makes Web applications fast, scalable, and a joy to create. WinForms, Web services, and click-once deployment have greatly simplified creating rich client applications. With Whidbey and Yukon looming over the horizon, and Longhorn and Avalon, XAML, and WinFS down the road, the future for VB's .NET managed code looks compelling.
Unfortunately, the story for VB6 unmanaged code isn't as good. Many still face the daunting task of re-architecting their applications, and the clock is ticking. Microsoft ends mainstream support for VB6 in March 2005, and VB6 developers risk having their applications stranded. Microsoft's advice regarding some VB6 applications is to "leave them where they are."
Microsoft's loyal customers deserve better. They deserve another version of VB6. I'd call it VB6Plus, VB6+ for short.
I envision VB6+ as an upgrade to VB6 that bridges the gap with VB.NET. You would create VB6+ projects in the Visual Studio .NET IDE, enabling you to work on both VB6 and VB.NET projects as part of a unified solution.
Opening an existing VB6 project in VB6+ would invoke a conversion wizard. This wizard would make syntax changes to the VB6 project to bring it inline with VB.NET syntax. For example, Property Get and Set declarations would be combined into nested blocks, as they are in VB.NET. Obsolete keywords such as Wend would be upgraded to End While. User-defined types would be renamed to Structures, rather than the potentially confusing Type. Parameter declarations would be explicit in the generated code. Classes and modules would use the Class and Module keywords.
The wizard would make these simple syntax and layout changes, producing VB code with a .NET look and feel. The updated code would compile to unmanaged code, and the compiler would have different levels of warnings and/or compatibility settings. When you first upgrade a VB6 project to VB6+, the compiler would default to its lowest level, allowing your project to compile in VB6+ with virtually no manual modifications. This is in distinct contrast to the experience you get when upgrading from VB6 to VB.NET, where you are often required to make many changes before you can even get your code to run.
VB6+ would include tools and added functionality to facilitate an eventual transition to VB.NET. You could incorporate the new features into your project, adjust the compiler settings, and make the modifications in a granular fashion. VB6+ would include an Option Strict option, as well as attributes on Win32 API declarations that would help you factor out the need for StrPtr. The Form and UserControl would both expose a WndProc event to help you move your code away from the use of ObjPtr.
VB6+ would introduce new functionality to VB6, such as formal interfaces. These would use the Implements keyword as it is used in VB.NET. "Inherits" could be supported in a pseudo COM-friendly manner by making the compiler implement the Interface of the base class, encapsulate an instance of the base class, and then pass the method calls through to it. The semantics would appear the same to the developer. You would even refer to the encapsulated instance through the MyBase keyword.
VB6+ would also include support for GDI+ and Web services. GDI+, which is an unmanaged library anyway, would help you abstract your drawing and printing code. Web services would enable greater interoperability with .NET and Microsoft Office System, making it easier for you to get your code working with .NET without having to move it all over at once.
VB6+ would serve an important need and provide a road forward for those who now feel left behind. VB6+ features could be replicated into Visual Studio for Applications, allowing a smoother move forward for VBA code as well. However, VB6+ shouldn't come at the expense of work on VB.NET. It was important that VB.NET forged ahead as it did, and it must continue to forge ahead. This does mean more investment by Microsoft, but this is an investment justified by the good will it would create. Microsoft needs to stretch out a warm hand to the community, to our sisters and brothers who feel left behind. VB6+ would be the welcoming hand to do that.
Bill McCarthy is an independent consultant based in Australia and is one of the foremost .NET language experts specializing in Visual Basic. He has been a Microsoft MVP for VB for the last nine years and sat in on internal development reviews with the Visual Basic team for the last five years where he helped to steer the language’s future direction. These days he writes his thoughts about language direction on his blog at http://msmvps.com/bill.