dcsimg
Results 1 to 8 of 8

Thread: [RESOLVED] How can I migrate my vb 6 program to vb 2017?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    75

    Resolved [RESOLVED] How can I migrate my vb 6 program to vb 2017?

    I have a large VB 6 project that I have been writing for six years. It is running in vb 6 on XP.

    I would like to convert it to run in VB 2017 on Win 10.

    I would like to do some sort of conversion to get my forms and code into vb 2017 so I can start the manual process of making them compatible.

    I have opened vb 2017 and used "open file" to load all the vb 6 forms

    and am faced with a "select startup item" that I can't get past.

    frmMain.frm doesn't work.

    What would be a good course of action?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,099

    Re: How can I migrate my vb 6 program to vb 2017?

    There is no good course of action.

    Back in the earlier days of VB.NET, up through VS2008, there was a conversion tool that did a pretty poor job of converting VB6 into VB.NET. Some people actually found it to work well. They may have been insane in other ways, as well. Most people found the conversion to be really bad, and MS subsequently dropped the tool. There is no other good alternative that I am aware of. The two languages are sufficiently different that a good conversion is very unlikely.

    That leaves you with a bit of a dilemma, because your choices are realistically these two:

    1) Stick with VB6 for that project.

    2) Convert it by hand.

    That latter option may sound horrible, and it could be if the project is really that big. I've converted over smaller programs, and found that the conversion is pretty quick. FAR quicker than writing it the first time around, but not insignificant, etiher. Most methods would copy over directly, with the only changes being that some types would have to change, most notably the Long in VB6 is now the Integer in .NET, and the Long in .NET is a 64-bit integer, which is almost never needed and comes at a very slight performance cost.

    Of course, some things won't convert over all that well. For example, VB6 had to make use of arrays for everything. In .NET, there are the far easier Generics, but there's no straight up conversion. Any time you are calling ReDim or ReDim Preserver, a generic List(of T) would likely reduce the code and improve performance, though the old way still works.

    Also, forms are a pretty different animal in .NET. Back in VB6, the form was an odd beast. In .NET, all controls and the form itself are just like any other part of the code. No strange frm files with odd stuff in them. There's just the .designer.vb file that holds all the controls and the form (and which isn't necessary and didn't exist prior to 2005), and the .vb file which holds all the event handlers. Whether there is any straight up form conversion tool, I couldn't say.
    My usual boring signature: Nothing

  3. #3
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    191

    Re: How can I migrate my vb 6 program to vb 2017?

    It is not recommended to switch from VB6 to VB2017, it is a nightmare! VB6 can be used and compiled normally in win10.
    QQ: 289778005

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,999

    Re: How can I migrate my vb 6 program to vb 2017?

    While I'm no fan of VB6 and I do write VB.NET code myself, I'm inclined to agree with ChecnLin in the general case. You pretty much have to rewrite your app using the functionality of the original as your requirements so it's no trivial thing. I'd suggest not doing it unless you have a good reason. If you've tested your VB6 app on Windows 10 and there are specific issues that cannot easily be addressed and/or you want to continue developing the application and would like to start with a more modern base then it may well be worth it. If you do it though, be sure to avoid repeating the mistakes of the past. Look to improve the design and architecture of your app so that future development becomes easier, e.g. don't write your data access code in your forms. Treat your existing app as a starting point for requirements, consider any new requirements that may come up and engage in a proper design phase in order to create the best VB.NET app you can.

  5. #5
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,316

    Re: How can I migrate my vb 6 program to vb 2017?

    I think the user just wants the forms converted. Which I can understand the hassle. I have had great success conversion rates with https://www.mobilize.net which is free for around 10k lines but that might of changed. Just remember to not include any unneeded code and take your time through the conversion process steps. Mainly it being converted to c#.

    As others have said though do not try and convert the code. With these tools the code is not actually converted but layers and layers of wrappers making the code even harder to convert. For a simple hello world VB6 project you would end up with 3 additional solutions simply wrapping it. I was going to provide an example but my trial has expired.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    75

    Re: How can I migrate my vb 6 program to vb 2017?

    Thank you all for these inputs.
    I would like to start with a more modern base and find a faster way to plot data.
    I also want to use a supported language.
    It looks like a long term project.

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

    Re: [RESOLVED] How can I migrate my vb 6 program to vb 2017?

    It likely is.

    If the code, as it stands, can be easily put into one or more (ideally more than one) dll, then there is an intermediate approach. You could package much of the functionality into dlls, then convert what is left manually, while still referencing the code in the dlls. You could then convert over the dlls as you get around to it. Of course, this would require that your existing code is either already in dlls, or can readily be moved to dlls.
    My usual boring signature: Nothing

  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,099

    Re: [RESOLVED] How can I migrate my vb 6 program to vb 2017?

    It likely is.

    If the code, as it stands, can be easily put into one or more (ideally more than one) dll, then there is an intermediate approach. You could package much of the functionality into dlls, then convert what is left manually, while still referencing the code in the dlls. You could then convert over the dlls as you get around to it. Of course, this would require that your existing code is either already in dlls, or can readily be moved to dlls.
    My usual boring signature: Nothing

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width