开发者

VB to C# or VB.net conversion

开发者 https://www.devze.com 2023-01-06 03:57 出处:网络
I have a VB application. Clients wanted to convert that to a .net application. I would like to go ahead and convert that to C# windows application. But I am not sure on challenges that I will be facin

I have a VB application. Clients wanted to convert that to a .net application. I would like to go ahead and convert that to C# windows application. But I am not sure on challenges that I will be facing.

One method is to just understand the VB code and rewrite all the modules in C# or VB .net

The other way that I am not aware of is the tool based conversion.

May I know how you would approach with such conversion? What type of tools you would prefer for conversion and challenges开发者_如何学Go that you might face?

For simplicity lets assume that we are going to convert a simple VB to a VB .net or c# windows application.

Would you prefer VB to VB.net conversion or VB to C# conversion. Even if you can answer this question in parts I would appreciate it.


You could to take a look into this article, it's worth reading as a warm up: Converting VB6 to VB.NET, Part I

My advice is to translate just pieces your user actually uses, adding new features as he/she demands.


There are many online code converters out there for simply converting syntax. Some examples are:

  • http://www.developerfusion.com/tools/convert/vb-to-csharp/
  • http://converter.telerik.com/

These converters will not take care of all the issues. For examples, arrays access is with () in VB, same as method accessor, whereas it is [] in C#. This poses a problem because the converters do not know which are methods and which are arrays.

Obviously, the biggest problem is the differences between old VB and .NET. Even if you do translate, you will likely fall into many problems regarding obsolete deprecated methods, constrictions, etc.

I would suggest to re-evaluate your application before using code converters so that you have an idea of what changes to expect.


Just a blog post with some pointers regarding migration from VB6 to VB.NET and C#:

VB6 to VB.Net Upgraded Upgrade Help – Yes, you are not alone (in your VB6’ness)…


I would choose C# because I am more comfortable with that syntax. I think you should choose the language you're most at home with.

I used to work with pre .Net VB, and I have done some VB.Net coding, but the similarities between those two languages are not big enough to direct that choice.

In any case, it will probably be more of a rewrite than a port because there are many technological differences in GUI, DB, file access, and so on.

I hope your existing product is structured well, it will help in the process. If it's not, it can well worth the time to refactor or restructure (call it what you will) before porting/rewriting.


Before I start: VB is not an object oriented language ... C# and VB.NET are! It's crucial that you bare this deep in your mind - developing object oriented is nothing like procedural programming. You can make your new system CODE look like your current - but you really shouldn't. If you don't feel like learning Object Oriented and change the way your application goes you should not start this project because you'll waste time and money and probably will fail. ...After all you don't dip your pen in ink well to refill it- old methods are interesting but technology is here for a reason. But I am not sure on challenges that I will be facing. ....You should learn object oriented. After that with the right questions it will be easy to get answers VB is no longer supported by Microsoft and you should not stay behind especially when the customers ask you to move it. It won't be easy - but you don't have a choice.

One method is to just understand the VB code and rewrite all the modules in C# or VB .net ....This is the only way - when things will start falling apart - you will not accuse the convertor - you are responsible to understand every function in your system

The other way that I am not aware of is the tool based conversion. ...others offered you tools - its good for syntax but risky for overall functionality

May I know how you would approach with such conversion? What type of tools you would prefer for conversion and challenges that you might face? ...map your functions with Visio word excel or more professional tools like UML diagram applications

For simplicity lets assume that we are going to convert a simple VB to a VB .net or c# windows application. ...building the forms is easy the components are usually more powerful

Would you prefer VB to VB.net conversion or VB to C# conversion. ... Choose C# vb make people think they are still in a vb environment... C# makes you understand you are in a different world. Yet it is important that you will know that Microsoft decided to align the two languages to have the same functionality.

There are good convertors from one language to the other.


In my experience, the best way to do this is to just rewrite the application.

Every time I tried to use an automated converter it failed miserably. There are many things in VB that just don't translate well (like control arrays).


It depends - on size of your application, on size of the GUI and non-GUI parts of your application, the external libraries/components your application uses and also which language (C# or VB.NET) you or your team feels more comfortable with.

If you can isolate a lot of non-GUI code in your old VB application, the "VB to VB.NET" road may often be the preferable one, because the chances are not bad that you can port a lot of your old code with only minor changes. In all other cases, C# or VB.NET are almost equal for this purpose, so choose the language you have most experience / most existing code / most know-how in your team.


The best way is to rewrite application. I think is better to use vb.NET because syntax is similar to vb. If you want to try a conversion tool I suggest VB Migration Partner. www.vbmigration.com

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号