• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

Help going from VB 5 to VB.Net (1 Viewer)

smiler44

Registered User.
Local time
Today, 02:39
Joined
Jul 15, 2008
Messages
641
I'm thinking of getting VB. Net and would like some advice please.

I have a project written in Visual Basic version 5.
Will VB.net be able to do the same things as VB5?

what is the best way to convert a project written in VB version 5 to vb.net?
I also have VB version 6 but have never used it.

Can VB.Net be obtained free and legal? Where is the best place to get it from?

thank you in advance

smiler44
 

static

Registered User.
Local time
Today, 02:39
Joined
Nov 2, 2015
Messages
823
Visual studio express is free for none commercial use.

vb.net will do anything that previous versions did.

Copy your old code in. It will give you a list of errors to fix.
The biggest difference I found when converting a VB6 project was dates which are no longer numeric.
 

vedika

Registered User.
Local time
Today, 08:09
Joined
Jan 24, 2019
Messages
11
These are steps to migrate to VB.Net

Decide whether to upgrade or not. There are program types that are best left in your current VB version. Projects that use UserControls, WebClasses, DHTML pages, VB's add-in model and other special techniques cannot easily be upgraded. Use a compatibility check tool to estimate what you can upgrade to VB.NET and how much work it will require. Alternatively, try to load your project in VB.NET and see the upgrade report for critical issues.

Remove dead and duplicated code. Start by deleting all the code your programs don't use. It is not uncommon to have 30-40% dead code in a medium or large sized project. Migrating that code means extra burden and no benefits. Additionally, you should consider joining any duplicated functions to reduce the amount of code even further. — Now, how do you know what code is dead or duplicated? Of course you can try to find that out manually, but if your goal is to minimize work, we strongly recommend that you get a decent source code analyzer to find the dead and duplicated code.

Upgrade problematic syntax and controls. Use of certain syntax and control versions will cause you a lot of trouble. Take the Data control or VB5 Common Controls controls (ComCtl32.ocx or ComCt232.ocx), for example. You must upgrade to ADO data control or MsComCtl.ocx and MsComCt2.ocx, respectively. And, if you happen to be still in VB3 or VB4, you must port it to VB6 first. Obsolete syntax like GoSubs need to get removed, and you even need to prepare your conditional compilation (#If statements). Fortunately, you don't have to upgrade everything, only those things that the VB.NET upgrade wizard doesn't handle. Use a compatibility check tool that recommends what to fix now and what to leave as is.

Fix your data declarations. If you've used a lot of Variants and undeclared variables, you're almost doomed. Now it's your final chance to add those Option Explicit statements and add proper type declarations to every Dim statement. Not only will this make your code more robust and optimized - it will also enable the upgrade wizard to properly port your code. Control object variable declarations are of special importance if you don't feel like writing half of your method and property calls again. In addition, certain array and user-defined structure definitions are going to change. Use a source code analyzer that lists the declarations requiring a fix.

Load your code in VB.NET. Let the upgrade wizard do its job. You'll get a large report detailing the found upgrade issues, both fixed and unfixed. You'll get comments in the code near places that need to get worked on. What you're not getting is a list of undetected issues, of course.

Try to compile your project. It won't succeed. You'll have a long list of compile errors. Now it really starts to pay off to be properly prepared. The list would be much longer if you hadn't prepared in advance.

Go back. You might want to go back to step 1, 2, 3 or 4, fix some issues, and then go to step 5 and run the upgrade wizard again.

Compile & fix cycle. Fix all the compiler issues. Finally, it runs.

Fix the commented issues. The upgrade wizard left comments in your code. Find them and do what they say. Now it's also beneficial to review a list of expected behavior changes, like events that won't fire.

Test. Now you're back to daily life. Run and test your program to make sure it works as expected.
 

Users who are viewing this thread

Top Bottom