Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

.NET Code Conversion - Convert your code

, 4 Feb 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
This post explains how to convert the code in .NET

Table of Contents


This post explains how to convert the code in .NET.


In lot of programming forums, you can find some questions related to code conversion. For example an enquirer asking a question in VB.NET & answerer(s) posting solution(s) but unfortunately its in C#(instead of VB.NET). After seeing the solution(s), the enquirer replying some thing like "My project developed in VB.NET but your solution is in C#, blah blah blah ....". Then answerer's reply will be something like "You can convert the code, search in web for code convertors". But sometimes Enquirer wants an offline convertor(Reason may be the Internet connection). So this simple post would be useful for them.


It's an Open Source Development Environment for .NET. You can download the tool here. Also take a look at the features of SharpDevelop & they have forum so if you have any questions that will help you. Using this you can convert the code.

Supported Programming Languages
For Code conversion, currently SharpDevelop supports the following languages.
  • C#
  • VB.NET
  • Boo
  • Python
  • Ruby
Code Conversion

After installation, create a blank project & write some code. Here I have written some C# code. Now click Tools menu, select option Convert code to & select the language which you want(Here I have selected VB.NET). That's all. Now the code has been converted & generated in new file.

C# Code

C#.NET Code



Online Convertors - Alternative way

Offline Convertors

Addin(s)/Web services

Addins created from online code conversion Web services.

A Visual Studio Add-In That Converts C# Code To Visual Basic

Before Conversion

Make sure your code is working, for example if you miss single { or anyother things then the conversion will show you syntax error(s) instead of output. See below.

The converter uses SharpDevelop's NRefactory to perform the conversion. For the conversion to work properly, you have to paste a full class or source code file because we don't do "magic" RegEx's or string replacement - our code converter uses a full blown parser, and that's why the source code must be valid.

Even convertors won't convert the code 100%. The main reason is some features doesn't exist in particular language, see the Further reading section. Even Commertial tools convert the code only 99% Or probably you need to code rewrite.

Remember, If you want convert VB6 to C# don't go with that option. Convert VB6 to VB.NET using VS wizard & make sure the code is working and then do VB.NET to C#

Code Rewrite

Read about Rewrite (programming) & check this post Rewrite Code From Scratch which contains good & bad reasons to avoid/code-rewrite.

Multiple Programming Languages in .NET

Alternatively you can use both code in your application if you don't want to convert the code, see below.

VB6 to .NET

VB6 is obsolete by a decade and was always horrible.[^]
Why is anyone still using VB6 in 2011 ? Self loathing ? A dinosaur who refused to move with the times ?[^]
VB6 is dead and was always a joke. Why are you using it ? [^]

In VS, You have a wizard to convert VB6 to VB.NET. AFAIK, There is no freeware to convert VB6 to VB.NET. BTW even if you convert the code using convertor, it won't do that 100%, you must need to do some/more manual changes. Particularly if you used any 3rd party components then it will be a big headache because they(3rd parties) always changing the things in every version, so the VB6 code will show syntax error(s) in VB.NET. Check this bunch.


Java to .NET

  • Java Language Conversion Assistant 2.0 - Java Language Conversion Assistant is a tool that automatically converts existing Java-language code into Visual C#
    Retirement of J# language and Java Language Conversion Assistant from future versions of Visual Studio Since customers have told us that the existing J# feature set largely meets their needs and usage of J# is declining, Microsoft is retiring the Visual J# product and Java Language Conversion Assistant tool to better allocate resources for other customer requirements. The J# language and JLCA tool will not be available in future versions of Visual Studio. To preserve existing customer investments in J#, Microsoft will continue to support the J# and JLCA technology that shipped with Visual Studio 2005 through to 2015 as per our product life-cycle strategy.
  • Janett - Java to .Net Translator - Janett translates Java syntax, constructs and calls to Java libraries to C# / .Net counterparts.
  • CSharpJavaMerger Framework - Free and open source C# and Java conversion tool.
  • Java 2 CSharp Translator for Eclipse - That tool makes it possible to automatic translate Eclipse java projects into Visual Studio projects. Generated code can be directly compiled and executed whitout any user modification.


Delphi to .NET

  • Delphi.NET - is a collection of Open Source tools and code components that enable Borland Delphi (version 5 or higher) to communicate with the Microsoft .NET-Framework.

C++ to .NET

ColdFusion to .NET


Further Reading



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


About the Author

Web Developer
India India
Programmer | Dude | ||||||
About him & his blog? check out here. Currently he's updating the site, he'll return soon there with more things*.
In Codeproject, he posted a blogpost & more than couple of Tip/Tricks, hope he'll write more soon.
Favorite techs are MVC, WCF, Mobile, HTML5, CSS3, jQuery, etc.,
His hobbies are watching movies, CP, being alone, etc., But now he's working on something*.
* - SCAMP???
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

GeneralNice Pinmemberkoolprasad200320-Jan-12 1:32 
GeneralRe: Nice Pinmvpthatraja22-Jan-12 17:35 
GeneralMy vote of 5 PinmvpKanasz Robert18-Jan-12 2:01 
GeneralRe: My vote of 5 Pinmvpthatraja22-Jan-12 17:34 
GeneralMy vote of 5 Pinmemberambarishtv17-Jan-12 2:22 
GeneralRe: My vote of 5 Pinmvpthatraja17-Jan-12 8:38 
GeneralMy vote of 5 PinmemberMarcus Kramer9-Jan-12 5:30 
GeneralRe: My vote of 5 Pinmvpthatraja10-Jan-12 2:58 
Yeah, I'm going to revise this post one more time with more details. Thanks for your feedback Pogoboy!

Code Conversion! || Nobody remains a virgin, Life screws everyone Sigh | :sigh:

BugMy Vote of 5 [Solved] PinmemberClark Kent1239-Jan-12 3:55 
GeneralRe: My Vote of 5 Pinmvpthatraja9-Jan-12 4:30 
QuestionMy Giving 5 PinmemberMarkDaniel8-Jan-12 23:53 
AnswerRe: My Giving 5 Pinmvpthatraja10-Jan-12 2:55 
QuestionCustom Handlers PinmemberSimon_Whale5-Jan-12 22:50 
AnswerRe: Custom Handlers Pinmvpthatraja7-Jan-12 10:50 
GeneralMy vote of 1 PinmemberKlaus Luedenscheidt5-Jan-12 19:58 
AnswerRe: My vote of 1 Pinmvpthatraja5-Jan-12 22:04 
AnswerRe: My vote of 1 Pinmvpthatraja7-Jan-12 10:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150326.1 | Last Updated 4 Feb 2012
Article Copyright 2012 by thatraja
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid