Can VB 6 and VB.NET forms coexist?

Time and money are two of the biggest reasons developers don't migrate VB 6 applications. A toolkit due later this year will let VB 6 and VB.NET forms coexist.

Visual Basic 2005 may be the latest incarnation of the 15-year-old programming language, but an ongoing survey of SearchVB.com readers indicates that more developers are still coding in VB 6 that in VB.NET. On top of that, Visual Basic 9, code-named Orcas, is due for release at the end of 2007. Each new release brings productivity enhancements but also questions about performance and migration.

At Tech Ed 2006, SearchVB.com attended several breakout sessions focused on Visual Basic 2005. This three-part series looks at the language's past, present and future.


Migrating a Visual Basic 6 application to VB.NET requires a significant investment of both time and money -- neither of which are in large supply for anyone. The process can be especially troublesome for large, forms-based applications, since in almost all cases a decent chunk of code will not make it through the VB 6 Conversion Wizard and will have to be converted by hand.

One option that will be available soon is a toolkit from Clarity Consulting that will let developers created "hybrid" applications in which VB 6 forms and VB.NET forms coexist in an application running on VB 6.

During a breakout session at Tech Ed, Jon Rauschenberger, CTO of Clarity, offered a demo of this toolkit. Clarity is developing the product jointly with Microsoft, and it will be available alter this summer as a free download.

The toolkit is not a code converter. Rather, it provides shared state, an application event broker and interoperable forms functionality. The latter piece, interoperable forms, is by far the most important part, Rauschenberger said.

More on VB 6 migration

Special Report: VB 6-to-VB.NET Migration

Tip: Migrating or converting from VB 6 to VB.NET

Developers create a new form in .NET and attribute the code, and the toolkit automatically generates a COM proxy. The resulting COM interface resembles a VB 6 form. "From a UI standpoint, you can't tell which version [of VB] I'm using," Rauschenberger said.

One major addition to VB.NET was My namespace, a resource locating framework that makes it easier to find and retrieve information from a file. Since VB 6 does not support My, the toolkit removes the resource and puts it in a namespace that VB 6 recognizes, Rauschenberger said.

"We want to keep VB 6 as familiar as possible while keeping the .NET experience as pure as possible," he continued. "There are no constraints on what you can do to a VB.NET form running in VB 6."

When migrating forms, it is a good idea to move over one functional unit at a time -- that is, both a master and a detail at the same time -- Rauschenberger said. Developers should also consider compiling all parts of a functional unit into a COM DLL; that way, there is a single executable, rather than one for each form.

Other considerations regarding the toolkit include the following:

  • The toolkit supports only four interface objects -- 32-bit integers, strings, Booleans and objects. This does hit 80% to 90% of support cases, Rauschenberger noted.
  • If a developer chooses to bring forward one VB 6 form in an interface, then all VB 6 forms will be brought forward.
  • When it's time to recompile VB.NET code, a developer has to close down VB 6. Otherwise, the build will fail.

    Go on to Part 2 of the series, Tips and time-savers for VB 2005 application development
    Go on to Part 3 of the series, What to expect from Vista development, VB 9

  • Dig deeper on .NET Framework 2.0 and Visual Studio 2005 development

    0 comments

    Oldest 

    Forgot Password?

    No problem! Submit your e-mail address below. We'll send you an email containing your password.

    Your password has been sent to:

    -ADS BY GOOGLE

    SearchCloudComputing

    SearchSoftwareQuality

    SearchSOA

    TheServerSide

    SearchCloudApplications

    Close