bhoogter / VB6TocSharp

Free converter from VB6 to C#. See README for quick-start. See Wiki for more information.
MIT No Attribution
89 stars 32 forks source link
bsd-license conversion convert converter csharp forms free migration migration-tool net upgrade vb vb6 vb6-application vb6-migration vbmigration vbtonet vs2017 wpf xaml

VB6 To C

A VB6 based VB6 -> C# 2017 converter.

Usage

Free to use. Free to fork. Free to contribute. Free to ask about. Free to sell. Free to sell under your own name... Free to do just about anything except say I can't (See LICENSE).

See below for basic information. See the Wiki for more detailed information. Feel free to contact for support.

Quick Start

  1. Open the file prj.vbp, start the program (Requires the VB6 IDE).
  2. Enter some config values into the Config form via the button.
  3. Now that you have selected your project, click the SCAN button. This helps the converter know the difference between Methods without parenthesis and variables/constants. It also builds a full list of imports (which can be cleaned up in the VS 2019 IDE via ^K^E).
  4. If you want, click SUPPORT to generate the basic project support structure.
    • Alternatively, the files VBExtension.cs and VBConstants.cs could be copied directly out of the project root and included somewhere else.
  5. Then, enter a filename and click Single File to try to convert the file you enter beside it.

If you want to convert the entire project, simply click ALL, and it will do the scan, support generation, and entire project conversion off the bat.

NOTE: It might not be the fastest, it still requires a manual effort, but it's faster than doing it ALL manually!

Updates 2021-12-01

The original version of the converter approached the problem in a block-by-block approach, separating every logical program unit into its own string and converting it on its own. As a result, the converter made multiple passes and basically ran extremely slow. After updating the linter to not use this approach, but simply to run through the code from top to bottom, it appeared evident that the converter could do the same thing with just as much accuracy.

So, released today is the v2 of the converter, along side v1, via radio buttons on the main form. Feel free to mix and match, convert the whole project with one, and then individual files with the other. Hopefully, with the two completely different approaches, one of the two will work out better than the other and will result in less work. Again, they are still, both, only an 80-90% conversion. There are many things you will have to do by hand and double-check (like loop bounds), but again, it sure beats changing all of the &s in your VB6 code to +s for C#.

How Do I ...?

There are a lot of questions when it comes to conversion. If you just want to know the way this converter deals with specific patterns, please see the How Do I ...? page in our wiki.

Whether you use this converter or not, we give our solution to commonly encountered conversion puzzles. Our solutions are quick, to the point, and don't generally use a lot of programming or context overhead. While they may rely on our extension module, all of it is native C# code, and, generally, fairly similar to what you did int VB6.

Requirements

Converter requirements

Converted program requirements

Instructions

Please see the wiki for more information on usage.

Design Considerations

Known Issues (v1 only)

Down-sides

NOTE: Most of the places the converter knows there will be a problem it will annotate the code with a // TODO: comment. Be sure to thoroughly address each of these.

Pluses

Extras

Future Possibilities

The project is largely as-is. It works at what it does. However, a few things to keep an eye on are things like "Extension Properties". If C# ever implemented this or something like it, converting .Visible = True becomes much more straight-forward. Because C# uses an enum now instead of a boolean, this isn't possible, but it would be with this feature.

Contact