Active3 years ago
Microsoft has released 'ArtinSoft’s Visual Basic Upgrade Companion (VBUC)' as a free downloadable tool to convert old VB6 code into.NET code (either VB.NET or C#). How can i convert a vb6 code into vb.net? Is there any converting tool available for that and how much reliable it is?
Does anyone know a way to convert from VB6 code to C#?
- To successfully convert VB6 to VB.NET requires modifications. There is not a completely automated, error free way to convert VB6 to VB.NET.
- Free online conversion utility to automatically convert your VB.NET code into C# - and straight back again.
- How can I convert VB6 code to. Do a conversion from VB6 to VB.NET. That treats.NET as a separate platform then rely on any of the conversion tools.
Is there a tool that can do this for me?
MarkJ27.9k44 gold badges5656 silver badges9797 bronze badges
baslbasl
closed as not constructive by user177800, Daniel Kelley, sgarizvi, koopajah, Laurent EtiembleFeb 13 '13 at 9:07
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question. Forkplayer torrent tv streaming.
10 Answers
VisualStudio offers (or at least offered) a wizard to do a conversion from VB6 to VB.NET (which could then be converted to C# with a bit of work, possibly helped by #develop's VB.NET <-> C# converter), but when last I used it, for anything non-trivial there was a lot of manual work needing to be done so I suspect you're probably better rewriting or porting by hand if this is a large and/or important application.
theraccoonbeartheraccoonbear3,26633 gold badges2727 silver badges3939 bronze badges
It might come across as a little bit cheeky but your brain might be the best tool to use. Could be worth the re-write.
Maybe you don't need to porting it. Could the VB6 be turned into a COM component?Port to COM, call from C#, home in time for Judge Judy.
Derek SmythDerek Smyth
As someone who has done this a bunch of times, this is not an easy process. You can use the VB6 to VB.Net tool as stated in this answer, and then use either Reflector or SharpDevelop to convert to C#. With the SharpDevelop conversion, a few caveats. It screws up all the array references and thinks that they are function calls, and all the logical operators are converted to bitwise logical operators (And becomes & not &&). With Reflector you lose a bunch of stuff. Also the Visual Studio converter fails on a lot of large projects, just hangs and never completes.
Once you have got your code converted into C#, you have to start the real work. The conversion gets you at best 50% of the way there, you have to fix a ton of stuff (you will see your code littered with TODO's), refactor a ton of stuff, and at the end you are left with C# that is a representation of your VB6 -- unless you have very nice VB6 code not a place you really want to be. Also all of your code with be littered with the VB helpers rather than using proper DotNet functions (all the string functions are helpers rather than class objects, for examples0. If you used Variants at all those all have to be rewritten. If you used a lot of API calls, they tend to need rewritting.
In the end you will get a base, but converting a large project (20-30 forms, 30 classes, 30 modules) can take several man months. Rewritting from scratch, however, may take twice as long and you lose all of your business logic. So, it can be done (I have done it with 3 or 4 large projects), but there is no panacea, no silver bullet, and any tool that says it will do it for you alone, is lying.
Community♦
Kris EricksonKris Erickson25.7k2626 gold badges108108 silver badges166166 bronze badges
Open your project with a new version of Visual Studio, convert your code to VB.Net and then download .Net Reflector to help you with the C# transformation.
Good luck!
Mark Biek97.7k5050 gold badges145145 silver badges194194 bronze badges
sebagomezVb6 To Vb Net Converter
sebagomez5,51955 gold badges4545 silver badges8080 bronze badges
Artinsoft (Now renamed to Mobilize.Net) does just this, especifically the Visual Basic Upgrade Companion.
However, even after using the VBUC there's still some parts that of the system that needs to be migrated/proofed by hand. But it's usually a much smaller set of the original problem. And some of the migration issues have been resolved thanks to experience with past migrations.
Artinsoft is the same company that built the wizard that ships with Visual Studio, mentioned in theraccoonbear's post. However, if I'm not mistake the wizard only migrates VB6 to VB.Net.
Full disclosure: I work for Artinsoft
willvv4,7461313 gold badges5555 silver badges9696 bronze badges
Esteban BrenesEsteban Brenes1,02311 gold badge1414 silver badges1919 bronze badges
The short answer is that VB6 and VB.NET (and consequently C#) are separate language but related languages. There are many subtle (Integer being Int32 instead of Int16) and gross differences (graphics, form, and printing engines) between the two platforms. You need to treat this as if you are converting to a completely different platform.
The issues is explored more fully here
Community♦
RS ConleyRS Conley6,90511 gold badge1616 silver badges3434 bronze badges
There are 2 free ones that I use:
Scott and the Dev TeamScott and the Dev Team![Tools Tools](/uploads/1/2/6/1/126136915/843209448.png)
1,63255 gold badges2424 silver badges4040 bronze badges
Microsoft recommends ArtinSoft’s Visual Basic Upgrade Companion (VBUC).
Microsoft and ArtinSoft have partnered to offer a free VBUC license to you. The discount code below can be used to purchase a license that will allow you to migrate an application of up to 10,000 lines of VB6 code to VB.NET or C# for free. It can also be applied when purchasing a larger license.
It's not perfect, resulting code still requires lots of manual fixes until it even compiles but still this tool is worth giving a shot.
Konstantin SpirinKonstantin Spirin![Vb.net Vb.net](/uploads/1/2/6/1/126136915/400488271.png)
12.7k1010 gold badges5656 silver badges8585 bronze badges
One question to ask yourself is, how important is it to have C# rather than VB.NET? If you're converting a large application, perhaps you should just upgrade to VB.NET, which will be cheaper.
There are some features in VB6 with no exact equivalent in C# (the error handling, late binding etc). Ask yourself why it's worth the manual effort to convert those, when you could go to VB.NET which does support them.
And if you don't believe me (and no-one's voted for my answer, sob sob!) maybe you'll believe Francesco Balena and Dan Appleman (in a book Moving to VB.NET) who agree with me.
MarkJMarkJ27.9k44 gold badges5656 silver badges9797 bronze badges
At GreatMigrations, we do this by hand -- we use our hands to develop a VB6/COM compiler. The compiler reads a VBP (or group of related VBPs) and referenced COM libraries and constructs a 'semantic model'. This model is an extremely detailed set of symbol tables and opcode streams that fully and accurately describe all information structures defined and operations performed by the source system.
The tool then applies a series of algorithms that modify and restructure the model to make it more compatible with .NET and optionally applies custom transformations; for example to replace COM components with .NET classes. The transformation rules are designed by people and created 'by hand' to meet their unique requirements.
Finally, the model is 'executed' but instead of allocating the data model and executing the operations, we author the file structures, data model, and operations in the notation of the target platform. We can author both VB.NET and C# using this approach. We also use this process to migrate ASP sites to ASPX, (we also have a multi-dialect FORTRAN-to-C product)
Convert Vb6 To Web Application
The approach does not produce production ready software on the first try, but it can be improved and made to produce 'better' software by modifying the configuration of the tool and re-running the translation process. The advantage of our tool is its repeatability, speed, and flexibility which facilitates an agile tool-assisted-rewrite methodology. IMO, migration teams that leverage our approach will benefit from allocating a lot more resources to evaluating alternatives for redesign, and development process improvements rather than to re-gathering functional requirements, hand coding, and testing. They will ultimately enjoy a more maintainable system and a much more faithful reproduction of the original application functionality after the migration as well as greater control and visibility during the migration.
Driver hours of service spreadsheet. Download the FREE Drivers Hours Spreadsheet. This free excel spreadsheet template allows you to keep track of your Drivers Hours to make sure you stay compliant with the drivers hours and working time directive rules. These are the requirements for two 1-5 a.m. Off-duty periods and the limitation on restart use to once per week (168 hours)). This set of logbook examples help explain the various provisions of the Hours-of-Service rules. Keeping track of the Hours of Service data for local drivers can be a hassle. When your drivers meet the requirements to use timesheets rather than log books, you are still responsible to maintain appropriate records of time. Filling out paper forms is time consuming and prone to mistakes. Excel hours of service spreadsheet drivers Excel. To get your Free version of the Drivers Hours Spreadsheet simply enter your name and email below and we will.
A trial edition of our tool is available here gmStudio Trail Request Download. It will allow you to experiment with ASP/VB codes up to 10K LOC and runs for up to 30 sessions.
Community♦
markmark
Not the answer you're looking for? Browse other questions tagged c#vb6portingvb6-migration or ask your own question.
VB.Net has a built-in migration tool, but converting VB6 code to VB.NET isn’t as easy as loading it to the newer software. The migration tool does a lot of the work, especially with syntax, but nowhere near all of it. You must work on your VB6 code before you try to load it in VB.Net.
Should You Upgrade the Code?
Some types of programs are best left in VB6. If your projects use WebClasses, DHTML pages, and UserControls, the migration to VB.NET may not go smoothly. That isn’t to say you shouldn’t try. The migration wizard will list any critical issues, and you can go back and fix them.
Preparing Your VB6 Code for Migration
Remove any dead code that your program doesn’t use and join any duplicated code to reduce the code more. You can do this manually if you are patient or your program isn’t lengthy, or you can use a source code analyzer program to locate the duplicated or unused code.
Fix Any Data Declarations
If you used undeclared variables in your program, you have a lot of work ahead of you. Add proper type declarations to every Dim statement and add Option Explicit statements. This will smooth the import process. Don’t worry, if you miss any, you’ll find out later.
VB.NET Wizard Goes to Work
Open your program in VB.NET and wait while the migration tool does its work. Expect to receive a lengthy report listing all the upgrade issues—the ones the wizard fixed and the ones it didn’t. There will also be comments in the code near spots that need extra work.
Try to Compile
Don’t even hope for your code to compile the first time through. It won’t, but you’ll receive a long list of compile errors that you can go back and fix.
Work on Your Code
Using the reports, return to your code and fix the critical issues. When you’ve done them all, load the code into VB.NET again. You may receive another list of critical issues to fix, but eventually, it will make it through the wizard and the compiler. You’re not done yet. Look for comments the migration tool left in your code and do whatever the comments say.
Now, run and test your program in VB.NET.