1. Computing

Converting VB6 to VB.NET

By January 24, 2011

Follow me on:

Brad wrote,

The VB6 to VB.NET converter doesn't seem to exist anymore. Microsoft sent me to Artinsoft. They apparently have a good one, but it will cost me $6000 to use for my smaller project and gobs more for the larger one.

Are there any competitors out there? Are there other choices beside recoding by hand?

Unfortunately, Microsoft's policy these days seems to be, "What part of 'We don't support VB6 anymore!' don't you understand?" I've blogged long and hard that this is a mistake for Microsoft so I won't plow that ground again. Microsoft does provide a small amount of support. For example, there's the Interop and Upgrade forum where you can ask questions. I blogged the announcement of a new third-party VB6 website back in 2007 called VB6.us. I checked them again for this blog and they're still online!

Inevitably, you will have to abandon VB6 some day. It's better to plan for an orderly transition than to be forced to do it in emergency mode when something breaks.

But you do have options!

First, you can continue to run VB6 programs and even develop using VB6 on even the latest version of Windows. (If you can find a VB6 system. You can't buy one at retail anymore but you can still get one with an MSDN subscription.) You have to install the system with an Administrator account. Some people have reported that Windows 7 must be run in Windows XP mode for best results in developing VB6 systems but the runtime is supported by all versions of Windows.

When you do decide to convert, you'll have to do it in two steps if you only use Microsoft products. As Brad discovered, Visual Studio 2010 doesn't include the VB6 conversion wizard anymore. But you can still download VB.NET 2008 Express. (Act fast! That won't last forever either.) 2008 does include the wizard. After that, you can convert the VB.NET 2008 code to VB.NET 2010.

Conversion of VB6 code usually only works for relatively small systems that don't involve a great deal of VB6-specific technology. The fact is that straight conversion projects of complex VB6 systems usually run into a wall after the easy part is done. The differences between the two languages are just too great. A great resource for deciding what to do can be found in this Microsoft blog: Rewrite vs Migrate vs Reuse vs Replace. The Microsoft Patterns and Practices group also has an article that will help: Upgrading Visual Basic 6.0 Applications to Visual Basic .NET and Visual Basic 2005.

If you do decide to go the conversion route, the software to help can be pretty pricey, as Brad found out. The main commercial competitors are ArtinSoft and VB Migration Partner. ArtinSoft prices their product by lines of code (LOC) and pricing starts at $800 for up to 10,000 LOC. VB Migration Partner doesn't quote a fixed price; they like to give you a bid after looking at your project.

While researching this blog, I ran into a message on another page that was so good that I decided to quote it in this blog. Addressing the same question, Darrel Miller wrote:

a) Hire someone with a significant amount of experience in building large .NET applications to come and guide the project and teach you.

b) Extract the business requirements from your current application and freeze them.

c) Celebrate the fact that this should be the easiest greenfield application development project ever because you have someone with experience in the technology to guide you, you have mature tools to build the application with and have a well defined set of requirements, so you know exactly what to build.

P.S. At this point I would not bother with Winforms. I would jump straight to WPF, you'll thank me later.

P.P.S The language really does not matter (C# or VB.Net). The effort will be the same.

Comments
January 25, 2011 at 4:20 am
(1) John McIlhinney says:

ArtinSoft prices their product by lines of code (LOC) and pricing starts at $800 for up to 10,000 LOC.

Actually:

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.

Migration – Upgrading from Visual Basic 6.0

January 25, 2011 at 12:40 pm
(2) Dan Mabbutt says:

Valuable information as usual. It’s interesting that they don’t mention this offer on the “Buy Now” page on their own site.

Although VB6 was great in it’s day, this is just another reason not to delay moving up to VB.NET. Once the market has evaporated, offers like this won’t be available.

January 25, 2011 at 4:30 pm
(3) Chris Anderson says:

When I attended a Wrox Conference many moons ago, 2002 as a matter of fact, just as the first version of .NET was rolling off the line, there was panel discussion where we got to ask questions of the .NET Product Development team.

The most memorable moment for me was when the inevitable question of upgrading existing VB6 code came up. After some groaning from the panel, we were then told (I want to attribute this to Anders Hejlsberg, but it was so long ago by now, that I’m not 100% who it was anymore) quite emphatically that the only reason there is a conversion tool is because people expected there to be one. In the original Betas, it hadn’t been included, because none had been built. The one that was being included was thrown together at the last minute. We were encouraged to treat it like new development, re-use & recycle what you can as far as logic goes, but at the same time upgrade it to .NET.

I think it says a lot when the development team tells you, “yeah, we gave you something, but I wouldn’t use it nor would I recommend others using it.”

Yes, they wanted to ease the transition, but at the same time, there’s only so much it can do. And one thing it won’t do (and rightfully so) is convert all that massive ADO code we used for so long. What ended up shipping was an 80% “solution” and that is only if you count the wrapping of ADO (Classic) into ADO Interop.

Oddly, as much as everyone ridicules VB6 as a “toy” language, I’m seeing more and more VB6 jobs becoming available. The VB6-Developer (full-time) is starting to become a rare breed. As more transition to .NET, no one wants to go back to the “Dark Ages” before Enlightenment and it’s being reflected in opportunities and salaries. It’s not all that different to what happened with COBOL, which is still out there alive and kicking.

January 27, 2011 at 10:46 am
(4) Dan Mabbutt says:

GREAT story! I love first person accounts like this. This is probably the best reason to attend conferences. You get a view of what’s going on that you just can’t get any other way.

Indeed, the same thing did happen with COBOL. There are several competitors offering .NET versions of COBOL. Actually, I think COBOL is probably healthier than VB6 since Microsoft isn’t doing everything they can to strangle COBOL behind the barn.

There are even lots of FORTRAN systems. When I visted the Very Large Array in New Mexico a few years ago, I found that all of their programming was still done in FORTRAN! I’ll bet they still use it.

On the other hand, who uses Algol or PL/1 or APL or Lisp or Pascal? I’ll bet the customer base is smaller than COBOL, FORTRAN and VB6. It’s one of the reasons I hesitate before being willing to go full bore into, for example, MVC.

January 28, 2011 at 12:13 am
(5) Larry says:

FORTRAN has such a huge base in big money applications in the scientific and engineering community and COBOL a similar huge base in many business systems, notably banks that continued support is not a huge surprise as their is some big money in these industries.

Clearly there is a huge investment in VB6 applications in the commercial and scientific community but these applications are smaller scale (in general) and no vendor has picked up VB6 for a variety of business and legal reasons I’m sure from Microsoft.

No one really owns the COBOL, FORTRAN standards and many other standards. VB6 isn’t really a truly open standard so a third party is not likely to pick these up and run with them without some legal and business hoops to jump through.

Microsoft had both COBOL and FORTRAN compilers and dropped these. More accurately I suppose they sold them off though I won’t swear to it but I think Microsoft COBOL may have been picked up by MicroFocus? And I’m not sure Compaq actually acquired Microsoft FORTRAN but they did have one which has made its journey through HP and then to Intel. I still keep a current subscription to the Intel FORTRAN compiler for some legacy work. This ‘flavor’ of FORTRAN uses the Microsoft Visual Studio IDE.

PL/1, now that brings back memories. Took a class in this once on my travels through college. Though mostly a FORTRAN developer at the time as an engineering student I did think PL/1 was a pretty good language. Still have a 1979 book by Joan K Hughes, PL/1 Structured Programming. It was under $20 for the hardcover at the time. Just checked and Amazon has a 1986 printing of the book in paperback at a whopping $109. Holy cow.

January 28, 2011 at 10:20 am
(6) Dan Mabbutt says:

Thanks for the walk down memory lane.

I was a big-time PL/1 programmer at one time. I worked at an IBM facility where PL/1 was required for all new programming. I wonder how much that eventually cost them. (And how much it contributed to their eventual demise.) Later, I wrote an entire system in PL/1 for an oil and gas company. Being young and foolish, I convinced them that it was the wave of the future. (And, since it was fully supported by “Big Blue”, who could doubt it?)

Your comment about the different way Microsoft has treated VB6 versus their versions of Cobol and Fortran illustrates what I mean about strangling VB6 behind the barn. Microsoft could have easily sold VB6 to a third party. (Delphi did that with their version of Pascal.) But No-o-o-o-o-o!! That would have meant that VB6 customers had an alternative. Microsoft wanted to force as many as possible to upgrade to .NET, even if it meant some would go to Java and other languages instead. You have to understand that Microsoft knew full well that .NET was a “bet the whole company” move at the time and anything that advanced .NET in any way was fair game. But still, it was something they did for their own benefit and not for their (formerly) loyal VB6 customer base.

(And, no, I’m not claiming that VB6 is in any way superior to .NET. It’s not. … Just that Microsoft forced the decision on their customers when they didn’t have to.)

January 28, 2011 at 12:18 pm
(7) Larry says:

I can see why in the first few versions of .NET why Microsoft would not relinquish VB6 to a third party. Before .NET 2.0 I don’t believe it was a very solid product. By .NET 3.5 it was not only a very solid product but approaching the 10 year mark for .NET it was a done deal and a far better product than VB6. Not because there was anything wrong with VB6 but it was now very old technology and the world had moved forward.

I can’t believe anyone would see VB6 as a competitor to .NET anymore, even those at Microsoft. Beyond the name it is a completely separate product. I don’t think anyone could detect a blip, even under a microscope, in Microsoft’s balance sheet if they either sold it or even made it Open Source.

The only commercial issue I suppose is VBA and VB6 are effectively the same product. That’s a whole separate discussion you have written about several times.

January 30, 2011 at 8:58 am
(8) Alberto Torres says:

Trying to convert a VB6 Code to .Net, for me have become:
1. Review and prepare the Code using Ctrl+F5. This operation compiles the code and given plenty of warning of any errors in the code. Better to make all the corrections.
2. I have been experiencing a better result if I use VB2005 (VB8) after completing step 1. The Code after being converted for VB8(2005) has plenty of comments and you can access them. That option is great for people new to .Net. It is a great guidance.
3. If you are planning to go to VB9(2008), you can use the code you just converted from VB8(2005) with just opening the solution file.
4. If planning to go to VB10(VB2010) you can obtain better results repeating all the steps above.
I have done this process many times, and have found a better Code at the End. I do consider that the supreme help is to convert the code to VB8(2005) and after you can go to the superior versions.

Enjoy.

January 30, 2011 at 10:51 am
(9) Dan Mabbutt says:

Thanks for letting us know what your experience has taught you.

Converting the syntax is the easy part. But it doesn’t do much to take advantage of the superior programming patterns available in .NET. It often leaves you with a system that performs worse than it did in VB6.

Does anyone else have experience in converting complex systems?

January 31, 2011 at 10:04 am
(10) pjm says:

On the other hand, who uses Algol or PL/1 or APL or Lisp or Pascal? Iíll bet the customer base is smaller than COBOL, FORTRAN and VB6.

Depends on who you ask and how you ask. See:

http://www.tiobe.com/content/paperinfo/tpci/index.html

FWIW, I maintain code written in VB6 and do new development in VB.Net, C#, and C++ as required. My preference would be C# because it’s enough different (as opposed to VB.NET) from VB6 that I don’t find myself typing VB6 code while using it.

January 31, 2011 at 10:52 am
(11) Dan Mabbutt says:

Indeed it does.

I was interested to see Assembler was making a big comeback in the table.

It was curious to me that Visual Basic was listed twice – Once in the main table and once again as “Visual Basic .NET”. So I read through the fine print and found this annotation:

The ratings are calculated by counting hits of the most popular search engines. The search query that is used is

+” programming”

In my work on this page, I do a LOT of searching. In addition About.com, the owner of the site, is almost pathological in their focus on search engines and how they work. There are two things to understand about them:

(1) They results they return change a lot because they change their proprietary internal search algorithms.

(2) Filtering out false positives and including all the real positives is impossible to do. Especially with a target like “Visual Basic” that can be so easily misinterpreted.

Still, that’s interesting information. Thanks for providing the link.

January 31, 2011 at 9:18 pm
(12) Rohit Dewal says:

I have been using vb6 for past 10 years right from the time I graduated. I would seriously like to covert to .net. Most of the code is easy to do.. and I can even manage eventually to get through. the difficult part..

But my applications depend heavily on com and third party ActiveX controls. I will have to continue using them. I was wondering whether problems like DLL hell and non compatibility would occur using vb .net. I am still try to get a grip of 2008.

February 1, 2011 at 10:22 am
(13) Dan Mabbutt says:

You can usually solve this problem by “wrappering” your COM objects. This article …

How to use ActiveX components in Visual Basic .NET

… was written for a previous version of VB.NET but it should still work for you.

This one might also help …

How to: Create COM Wrappers

February 1, 2011 at 1:23 pm
(14) Abhijit says:

I used to be in the same predicament as Rohit, but I got to dabble in other stuff like JSP Servlets and .NET webservices for certain other things.

I am now writing more .NET code than legacy. I feel that once you get into the legacy code maintenance trap, it is tough to escape it.

February 5, 2011 at 11:54 am
(15) William K says:

Hi,
I have to convert an old VB5 App at work but having some real problems, I have read all the past comments and followed the links but still think the easy way is to :-

REWRITE the whole project in 2010 net, and i will know that the code works and can be upgraded if needed later.

trust MS to make it easy !!!!

February 9, 2011 at 7:59 am
(16) Greg says:

Can someone one help me to figure out this program. I am trying to get data from a flat file. put when i run the progam I am getting could not find installable ISAM.

Sub GetData_From_text_file(Text)
‘Step 1: Declare your variables
Dim MyConnect As String
Dim MyRecordset As ADODB.Recordset
Dim MyTable As ADODB.Recordset
Dim MySQL As String

‘Step 2: Declare your connection string
MyConnect = ” Provider=Microsoft.Ace.OledB.12.0;” & _
“Data Source= C:\Users\owner\Desktop\;” & _
“Extended Properties=text 12.0″

‘Step 3: Build your SQL statement
MySQL = ” SELECT * FROM [test.txt] ”

‘Step 4: Instantiate and specify your recordset
Set MyRecordset = New ADODB.Recordset
MyRecordset.Open MySQL, MyConnect, adOpenStatic, adLockReadOnly

‘Step 5: Clear Previous contents

Text(“EXCEL_TEST_FILE”).select
ActiveSheet.cellls.Clear

‘Step 6: Copy the record to excel
ActiveSheet.Rang(“A1:Z1″).CopyFromRecordset Myrecordese

End Sub

February 10, 2011 at 6:43 pm
(17) Dan Mabbutt says:

I’d like to help, but it’s difficult to know where to start. Your code appears to be intended to reference an Excel workbook, not a flat file. Your code also has a number of syntax errors and it’s clear that it’s just parts of a larger program.

The “could not find installable ISAM” error is usually caused by software that is not updated to the correct version. But to solve this problem, I have to know everything about what software you’re trying to use. Since your question is a comment to a blog that talks about both VB6 and VB.NET, you might be using anything.

Please provide more complete information and repost your question.

June 19, 2012 at 3:34 am
(18) Kai says:

Fore all those still wanting to download Vb 2008 The new link is:
Visual Studio 2008 Express Download

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
  1. About.com
  2. Computing
  3. Visual Basic

©2014 About.com. All rights reserved.