Migrating VB 6 to VB Net

Last post 06-24-2009 7:40 AM by paudstuff. 2 replies.

Sort Posts:

  • Migrating VB 6 to VB Net

    06-16-2008, 4:08 PM
    • Member
      8 point Member
    • Buddypup
    • Member since 08-24-2007, 2:30 PM
    • Posts 55

    I couldnt find a forum that matched exactly to this question but .. Reportedly there was a Microsoft tool called either the "Migration Tool" or VB6 to VB Net that automated the conversion of VB6 to VB .Net. Now I understand it was made available in some Professional editions back in 03 . I do volunteer programming for non-profits and there is an app written in VB 6 that provides a Telnet server and client. I have seen numerous requests for a Telnet server and client in VB Net at a price that one can afford. Is the Migration Tool available somewhere for us simple people?

    Appreciate the help anyone can give me.

    If there is a better matching forum, I would gladly post this question there.

    Buddypup

  • Re: Migrating VB 6 to VB Net

    06-16-2008, 4:32 PM
    Answer
    • Star
      13,648 point Star
    • cathal
    • Member since 06-18-2002, 4:02 PM
    • Belfast, Northern Ireland
    • Posts 2,702
    • TrustedFriends-MVPs

    one of the vb.net forums @ http://forums.msdn.microsoft.com/en/Forums/ is probably a better option, there are some excellent commercial tools out there such as those @ http://www.vbmigration.com/ (they also blogged about a free analyzer @ http://www.vbmigration.com/Blog/post/2008/06/VB6-Bulk-Analyzer%2c-a-command-line-tool-to-explore-multiple-VB-projects.aspx that might be worth a look)

    As for the "free" tools, if you're running vs.net 2005/vs.net 2008, the following should get you there with a bit of effort:

     

    Tools required

     

    Mandatory

    • Visual Basic 6 (usually installed as part of Visual studio)
    • Visual Basic 2005 (usually installed as part of visual studio 2005)
     

    Recommended

      Step 1: Prepare code for migration
    • Open the project in VB6.
    • Remove any files not required for the migration. In some cases, the removal of these will cause the project to stop compiling so you may want to leave them in for now (to test your changes), and ignore any fixit’s for those classes
    • Ensure that the code advisor addin is loaded (under the ‘Add-ins’ menu item there should be a ‘code advisor’ item)
    • Use that menu item and set the code advisor scope to ‘active project’
    • Now select ‘add fix-its’
    • View the fix-it report. This will list all the issues, their positions and also an explanation of what the issue is.
    • Now step through the project via the ‘find next fix-it function’, and investigate the suggested changes. Replace/remove code as necessary. Where code cannot be replaced with a function that will map to a .net function, comment out the offending code and make a note that you will need to rewrite that function after the migration e.g. the App.LogEvent code will need to be rewritten. In some cases, particularly the ‘Late Binding of Variant or Object’ warning, no change will be required e.g. a function might return either a recordset or an integer, so it needs to use a generic object
    • Once finished, select ‘remove fix-its’
    • Re-run the advisor again to ensure that you have made all necessary changes
     Step 2: Migrate code
    • Open the project in vs.net 2005
    • Select all the default options for the migration wizard
    • Once the migration is finished you will have a large number of UPGRADE_WARNINGS. These will typically fall into a few categories, so investigate each category and generate a fix for it. In some cases, it is better to retrospectively make the fix in the VB6 and then migrate the code again e.g. changing a return type from “Object” to a strongly-typed variable may fix a number of UPGRADE_WARNINGS. The case that typically requires most evaluation is the “Use of Null/IsNull” warning. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbup1049.asp for details. Note: When in doubt leave the warning in, you will need to test this later when  you have calling code (i.e. the asp.net layer)
    • To try and preserve a com-interop path the migration wizard will automatically add the InteropServices attribute at the class level, please remove this i.e. <System.Runtime.InteropServices.ProgId("clsHeader_NET.clsHeader")>
      Step 3: Post migration fixes
    • Once the to-do’s have been done, perform a Build (build->build solution)
    • Now, check the source of each error and warning in turn, and fix if necessary
    • Add any new code as replacement for functions stubbed as part of step 1.
    • Remove any ‘'UPGRADE_WARNINGS:’ comment lines (if possible)
     Step 4: Remove COM-interop (optional)
    • Select the project, and then click ‘show all files’
    • Expand the references node, and remove any com-interop items i.e. click on each in turn, and any that has ‘ActiveX’ as it’s file type is to be removed.
    • Recompile the code, and fix any issues. In most cases this will require rewrites for .net functionality.
     
  • Re: Migrating VB 6 to VB Net

    06-24-2009, 7:40 AM
    • Member
      2 point Member
    • paudstuff
    • Member since 06-24-2009, 7:21 AM
    • Posts 1

    We found that migration from vb to .net was made simple by the use of software we found on the web.

    The best site is probably www.newcode.com, they offer a free trial and assessment so you know what you need before you have to buy.


Page 1 of 1 (3 items)