Home > Microsoft .Net Development Tips > Visual Basic and Visual Basic .NET > Migrating or converting from VB 6 to VB.NET
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

VISUAL BASIC AND VISUAL BASIC .NET

Migrating or converting from VB 6 to VB.NET


Ed Tittel, Contributor
06.03.2005
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


The quick, dirty, and somewhat incomplete—but still useful—way to meet the need of migrating code from Visual Basic 6 to VB.NET.is "Get the right tool for the job." To be a little less oblique, let me hasten to point out that any number of reputable development tools companies will happily sell you tools that they claim will automate as much as 98% of the work involved in moving a code base from VB 6 to VB.NET. I also believe that the bigger or more valuable the code base that needs to move from the older to the newer environment, the easier it will be to justify the costs involved. Some of the vendors that offer tools for this purpose include:

  • Lexient Surveyor: supports n-tier separations and conversions from VB versions 5 or 6 to VB.NET,
  • Aviosto Project Analyzer 7.1: provides metrics for all types of VB code and helps to scope and estimate conversion needs and efforts, and
  • StressSoft Company VBto Converter: converts VB forms to VB.NET, C#.NET, Visual C++, Borland Builder or Delphi formats.
  • VB.NET itself also includes a "Conversion Wizard" that converts a subset of VB 6 code to VB.NET code. But before this conversion tool really helps much, most experts recommend that programmers perform some manual preparation to help adjust for the differences between the two language versions. In fact, most claim that the more (and better) the preparation, the fewer errors there will be to fix in the converted code output from that utility.

    What's involved in this preparation process also helps clarify some important differences between VB 6 and VB.NET. Data types from VB 6 need to be reworked for VB.NET, particularly the variant data type, which accepts any form of data as input. Though this construct makes coding easy because it doesn't require strict definition of or typing for variables, it doesn't work in VB.NET, where object replaces variant. Among other things, this means searching VB 6 code for instances of variant, and replacing them with strongly typed variables or objects before using the Conversion Wizard on your code.

    Something else that has to be eliminated during conversion is use of the goto on error statement. Though this has long been a convenient feature of Basic, it often adds to code complexity as well. VB.NET will force the introduction and use of more rigorous error identification and handling methods, and can therefore help to produce code that is easier to understand and maintain.

    When the VB conversion tool is run, it flags any code it can't convert, and also provides links to additional explanatory information to explain what failed, and what kinds of solutions may be called for. But it's also important to consider that a rough and ready conversion doesn't do anything to exploit VB.NET's enhanced tools or capabilities. It's probably also desirable to conduct a design review and to consider which .NET features might be worth adding to a reworked application, since some effort to make the switch will be needed anyway. At the same time, it's probably also worthwhile to take additional steps to produce better modularized and more readable code as well.

    By making the switch from VB 6 to VB.NET, a whole new world of features and functions become available. Careful combination of automated assistance, redesign, and reimplementation can produce better code than what is replaced. But it will take time, effort, and probably a bit of expenditure to carry the process to completion.

    Here are a few other resources you may want to try.
    Moving from Visual Basic to ASP.NET (Microsoft)
    Using Visual Basic .NET (Microsoft)
    Migrating from VB 6.0 to VB.NET – Some Tips (Dotnet Spider)
    NeST Technology (NeST Technology)
    Migrating applications from Visual Basic 6.0 to .NET (ELLKAY Solutions)
    Migrating to VB.NET (Meghande Deshpande, SearchVB.com)

    Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. E-mail Ed at etittel@techtarget.com with comments, questions, or suggested topics or tools to review.


    Rate this Tip
    To rate tips, you must be a member of SearchWinDevelopment.com.
    Register now to start rating these tips. Log in if you are already a member.




    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



    RELATED CONTENT
    Visual Basic and Visual Basic .NET
    Compose XML more quickly using Visual Basic 9
    Virtualization keeps Legacy Apps alive
    VB 9 Anonymous Types help create flexible objects
    Visual Studio Team System Add-ins: Conchango Scrum for Team System and Scrum Dashboard
    Book Excerpt: Sams Teach Yourself Visual Basic 2008 in 24 Hours -- Complete Starter Kit
    Check out CodePlex for a ton of interesting .NET projects
    Book excerpt: Murach's VB 2008
    Book excerpt: Printing in Visual Basic 2005
    Visual Basic 2008 and closures
    WinForms development using SQL Server 2005 and Visual Basic 2005

    VB 6 to VB .NET Migration
    On managing a .NET Framework 1.x migration
    Tool translates VB .NET code to Java
    Microsoft unveils VB 2005 'Power Packs'
    Mini-Guide: The VB.NET Development Environment, Part 3
    Mini-Guide: The VB.NET Development Environment, Part 2
    Mini-Guide: The VB.NET Development Environment, Part 1
    Put VB.NET events in the hands of AddHandler
    Choosing VB.NET or C# Learning Guide
    Object-Oriented Programming in VB .NET Learning Guide
    Quiz: What do you know about VB 6 migration?

    RELATED GLOSSARY TERMS
    Terms from Whatis.com − the technology online dictionary
    .NET  (SearchWinDevelopment.com)

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary

    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



    Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts