Results 1 to 12 of 12

Thread: Migrating a project from VB6 (!!) to VB2017

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2014
    Posts
    313

    Migrating a project from VB6 (!!) to VB2017

    Notes for myself, and others.

    1) Open in VB6.
    Run project to make sure everything works and is updated.

    2) Open that project in VB Express 2008.
    Migrate!

    3) Open the .vbproj in VS 2013.
    Permanent migration. Never look back!

    4) Open VS2013 project in VS2017 / VSCommunity

    WOW. This is unreal that it actually worked.
    Last edited by RipVoidWinkle; May 22nd, 2017 at 06:12 PM.

  2. #2
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: Migrating a project from VB6 (!!) to VB2017

    I'm impressed #2 worked well enough for you.

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Migrating a project from VB6 (!!) to VB2017

    While it "works" ... it's not really a good practice. It's really only going to work for the basic of applications. It doesn't really update anything except the project itself. All ActiveX objects remain as they are, but may get slapped with a wrapper around it. It doesn't upgrade any use of ADO to ADO.NET. I don't think it changes much code... I'm not even sure it updates event handlers with Handles clauses, or if it wires them up with AddHandler.

    It may be useful in getting a project started migrating to .NET, I wouldn't rely on the results as a long-term solution. The general recommendation is to re-start the project as a new one and go through the design. That doesn't necessarily mean chucking the old code. It can be cleaned up and ported over, but it should be a conscious effort and should also still be updated as needed.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Migrating a project from VB6 (!!) to VB2017

    Even if the upgrade wizard worked, it didn't work well. However, if it DID work, then you could probably do a good job relatively easily. It wouldn't take you long to recreate the forms in .NET to look the same. Then you can copy and paste the method bodies into the event handlers, and copy other methods, changing as needed. The syntax is largely the same, but you can make changes as needed. This will end up with a better overall project. It isn't as fast as what you did, but it will be pretty fast. I did this on a modestly sized project, and the whole conversion took only a day or two. It was FAR faster than the original writing.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2014
    Posts
    313

    Re: Migrating a project from VB6 (!!) to VB2017

    These are simple hobbyist caliber single form apps.
    I noticed it had some pixelToTwips stuff in there, and I started removing that line by line.

    The other thing I notice is the use of control arrays.
    I am going to repaint the screen on a new form, and create arrays of controls explicitly (the code is hidden in the designer.vb or whatever)

    I also noticed the event handlers have different arguments, so I manually cleaned up that code. eg: KeyPress
    Paste body into new event handler template in VS2013.

    It's not perfect, but it was a huge step in the right direction.

  6. #6
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    481

    Re: Migrating a project from VB6 (!!) to VB2017

    Topic title should be renamed, how to move your vb6 project from closed source to open source...

    Will try this soon, but I would imagine my 100k LOC project will not convert.

    WP

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Migrating a project from VB6 (!!) to VB2017

    Quote Originally Posted by axisdj View Post
    Topic title should be renamed, how to move your vb6 project from closed source to open source...

    Will try this soon, but I would imagine my 100k LOC project will not convert.

    WP
    It most certainly will NOT convert. At least, not to your satisfaction. What RVW is talking about is pretty simple apps, which may well convert well enough. Even in that case, he said he was manually cleaning up some code.

    Besides, there is a crucial step that you probably can't perform: Open the project in VB Express 2008.

    The key here is that 2008 was the last year that included the conversion application, which is why it worked at all. That conversion wizard was always pretty lousy and worked only somewhat on smaller programs. It was dropped entirely after 2008 as a bad piece of work. The languages are too different for any kind of automatic conversion to really matter.
    My usual boring signature: Nothing

  8. #8
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,046

    Re: Migrating a project from VB6 (!!) to VB2017

    Hi,

    I also tried to convert with vb2008, what came out I would discribe as

    .Vbet6

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  9. #9
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Migrating a project from VB6 (!!) to VB2017

    You did run your full suite of acceptance tests, right?
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  10. #10
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Migrating a project from VB6 (!!) to VB2017

    Quote Originally Posted by Sitten Spynne View Post
    You did run your full suite of acceptance tests, right?
    for a single form hobbyist app?

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Migrating a project from VB6 (!!) to VB2017

    Yeah, for a single form hobbyist app.

    Acceptance Tests:

    1) Does it work?
    My usual boring signature: Nothing

  12. #12
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Migrating a project from VB6 (!!) to VB2017

    Yes, for a single-form hobbyist app. Shaggy Hiker is more or less on the mark with what the acceptance test suite for such a thing might be.

    You left out "I was translating a single-form hobbyist app". Those are so simple one can usually convert them by hand faster than installing 3 separate versions of Visual Studio and mucking about with multiple tools. The kind of people who usually ask about this tool are converting big enterprise apps and curious if it "just works", so it's important to mention the product scale so as not to mislead them.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width