Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how can i convert a vb6 code into vb.net? Is there any converting tool available for that and how much reliable it is?
Posted
Updated 9-Aug-22 20:59pm
Comments
Richard C Bishop 16-Sep-13 14:35pm    
That would be a good question to ask a search engine.
Maciej Los 16-Sep-13 14:39pm    
It's possible to answer. See mine ;)
[no name] 16-Sep-13 14:39pm    
If you only need to convert "a vb6 code" then why do you need a converter? If on the other hand, you need to convert a whole bunch of code it might just easier to rewrite the code in .NET. VB6 is no longer supported and the programming paradigm is vastly different.

It depends on what VB6 code do.... There is no simply way to achieve that. Please see this: .NET Code Conversion - Convert your code[^]

More:
Migrate Your VB6 Code to VB.NET[^]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 16-Sep-13 14:42pm    
Sure, 5ed. I provided a link to a difference source, please see.
—SA
Maciej Los 16-Sep-13 15:26pm    
Thank you, Sergey ;)
This CodeProject article will give you a pretty good idea: Upgrading VB6 to VB.NET[^].

However, please don't expect good results. As the concepts of .NET are very different and powerful compared to absolutely dreadful VB6, the rate of success will be moderate at best, and the quality of translation can hardly be acceptable. It would be wise to consider the result of automatic migration only as the initial step, in best case. You will need to learn .NET seriously and use this technology properly in new project. In many cases, automatic migration can only delay this goal, compared to the strategy of writing your new project using .NET from scratch, using your VB6 source only for reference. It actually highly depends on how bad is your legacy code.

—SA
 
Share this answer
 
Comments
Maciej Los 16-Sep-13 15:26pm    
+5
Sergey Alexandrovich Kryukov 16-Sep-13 15:31pm    
Thank you, Maciej.
—SA
depends on what your long term strategy is.
how much you want to spend vs the saving in time etc.
plus you never going to get a 100% conversion unless the application is really simple. in which case the question would be why not just re-write it.
have a look at migration partner (vbmigration dot com) .seems decent enough. I played with it a bit and even got a quote at one stage but in the end we decided to rewrite our app into a thin client using java.
 
Share this answer
 
I am finishing up the first stage of a large migration from vb6 to .NET. There are actually several large applications that will ultimately be ported. To make matters more complicated, I am converting the resulting project to C# and WPF.

My methodology has been to use the VS2008 VB6 to VB.Net converter to do the initial conversion. I then passed the output of that to C-Sharpener, an open source .NET IDE. It has a decent VB.NET to C# converter. Not all of the original VB6 forms and classes made it through to the end, but the majority of them did.

I decided at the start to completely rewrite the UI (WPF made more sense to me than Winforms) and transfer as much of the back end logic as possible which was actually relatively easy (not simple, but easy). Depending on the VB to C# conversion some syntax may not be done properly such as arrays may or may not be changed from () to [] usage but that is trivial (time consuming, but trivial). Also, there needed to be a change from DAO to System.Data Dataset usage. This was made easier than it would otherwise have been by the use of a class oriented representation of each of the database tables complete with all of the data access logic. I wrote a utility that generated these classes from the Access tables used in the old application ( I would be happy to share this method ). That greatly simplified the code changes needed to change the DAO statements.

I stepped through the VB6 modules one by one until each was operational. The UI rewrite to
WPF was the most time consuming, but the most enjoyable aspect. The transfer of back end logic was much faster as that mostly entailed syntax and data access changes while the basic logic came through unchanged.

After several months and 500K lines of code the first application in my system's suite of applications is up and running. It will be offered as a beta to my clients in a matter of weeks.

Overall, it was a great deal of work. I think, however, that my approach allowed me to complete the process in a relatively short amount of time. Additionally the product of the process is robust and works like the original VB6 app.

Now for the next application!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900