|
-
Mar 4th, 2010, 08:18 PM
#1
Converting code from one language to another
Hi,
I used to program in Visual Basic 6.0 and until I gave up computer programming in 2007 and have only got back in to it this year. Now, since school stopped teaching vb.net we've be learning c# and that got me thinking is it possible to convert a program written in a language such as vb6.0 into vb.net or c# code without having to rewrite all the code from scratch?
I have been doing some research on the subject and some companies claim to have tools that assist in the conversion of code from one language to another, one such company I found is Great Migrations.
The above site talks about the methodology they use in order to achieve the results for their client. Well, rewriting the code seems like a hassle when converting from VB6 to .Net but I guess they do more than have the codes for both vb6.0, etc and by trial and error match to corresponding net equivalent?
Also, Is there a lot involved in converting between the .net languages?
This is something I found interesting and I know little about the subject because I might need to upgrade my program code, etc in the future.
Thanks,
Nightwalker
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 4th, 2010, 08:55 PM
#2
Re: Converting code from one language to another
There is virtually no problem converting from one .NET to another, but as for moving VB6 to .NET, there you are better off re-writing from scratch. You can crib pieces from the VB6, such as individual functions, interface layout, and some other things, but .NET is an OO language, while VB6 is not. This means that a good design in VB6, while possible in .NET, is not a good design in .NET.
My usual boring signature: Nothing
 
-
Mar 4th, 2010, 09:50 PM
#3
Re: Converting code from one language to another
Yeah, someone in another thread talking about c++ to c# code said that there is basically nothing to stop you from converting .net language program to another .net language. How different would the methods used in converting from vb6.0 to.net rather than .net to .net? As stated above that site talks about their own methodology for doing such things. Would it be any different from the other development methodologies?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 5th, 2010, 02:30 AM
#4
New Member
Re: Converting code from one language to another
Hi There,
I am a new here and would like your expert opinion.If there a software already coded in Vb.net now needs to be converted/migrated to Asp.Net. Will such a process be time consuming?
thanks in advance
-
Mar 5th, 2010, 03:20 AM
#5
Re: Converting code from one language to another
 Originally Posted by Nightwalker83
Yeah, someone in another thread talking about c++ to c# code said that there is basically nothing to stop you from converting .net language program to another .net language. How different would the methods used in converting from vb6.0 to.net rather than .net to .net? As stated above that site talks about their own methodology for doing such things. Would it be any different from the other development methodologies?
All .NET languages are compiled to MSIL before execution.
That means that the MSIL for code written in any .net language would be same, and as such is possible to convert from one to another.
It is even possible to write your application partially in one language and partially in another, since both will compile to a common intermediate language at runtime.
But conversion from VB6 to .NET has nothing common in between. VB6 is compiled to binary form while vb.net is compiled to IL. That's why it is not possible to easily convert from one to another.
-
Mar 5th, 2010, 03:23 AM
#6
Re: Converting code from one language to another
 Originally Posted by Newbie 407
Hi There,
I am a new here and would like your expert opinion.If there a software already coded in Vb.net now needs to be converted/migrated to Asp.Net. Will such a process be time consuming?
thanks in advance
VB.NET (forms) application and ASP.NET application are technologically different. They render to different UI. A vb.net forms application is designed to be rendered in a window, while asp.net applicaiton renders into a webbrowser. Also vb.net is standalone while asp.net is client-server based. Moreover, the controls are different. e.g. A VB.NET TextBox is not the same as ASP.NET TextBox. They have been coded to be as similar as possible w.r.t. functionality and available members(properties/events/methods). But they derive from different bases.
So it is not possible to convert one to the other.
-
Mar 5th, 2010, 04:44 AM
#7
Re: Converting code from one language to another
 Originally Posted by Pradeep1210
All .NET languages are compiled to MSIL before execution.
That means that the MSIL for code written in any .net language would be same, and as such is possible to convert from one to another.
It is even possible to write your application partially in one language and partially in another, since both will compile to a common intermediate language at runtime.
But conversion from VB6 to .NET has nothing common in between. VB6 is compiled to binary form while vb.net is compiled to IL. That's why it is not possible to easily convert from one to another.
Ah ok! I thought it would be something like that. What is MSIL and IL? If I ever needed to recode a vb6.0 project in .net is it as simple as picking a language as c# and start replacing the vb6.0 code, etc with the c# code or are there others factors needed to be taken into account?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 5th, 2010, 05:55 AM
#8
Re: Converting code from one language to another
 Originally Posted by Nightwalker83
Ah ok! I thought it would be something like that. What is MSIL and IL? If I ever needed to recode a vb6.0 project in .net is it as simple as picking a language as c# and start replacing the vb6.0 code, etc with the c# code or are there others factors needed to be taken into account?
Microsoft Intermediate Language (also called MSIL or IL in short) is an intermediate language between the machine (binary) language and high level language. In simple words, you may call it a half compiled language. The JIT (Just-in-Time) compiler compiles that MSIL into machine language on the fly when you execute the code, as opposed to VB6 or C++ which are directly compiled to machine language by the compiler.
The benefits of MSIL is that it can determine the most efficient way to execute your code on the move, whereas VB6 programs are precompiled and can't be optimized without compiling from the source code again with different compilation parameters.
There are many more benefits too. Have a look at this:
http://msdn.microsoft.com/en-us/library/c5tkafs1.aspx
-
Mar 5th, 2010, 09:09 AM
#9
Re: Converting code from one language to another
Thanks for the insight! Also, while searching in google about how to convert VB6.0 code to C# code I came across a post by Brian Bischof and the link to his book: The .NET Languages: A Quick Translation Guide which, covers the translation between VB6.0, VB.NET and C#. It seems like it might be a good place to start if I were ever in need of a way to convert code between the three languages.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 5th, 2010, 09:21 AM
#10
Re: Converting code from one language to another
Also Microsoft decided to break compatibility with previous versions of Visual Basic, when VB.NET was introduced. So there are a few things in VB6 that have no equivalent in VB.NET and vice-versa. There are also a few things that are common in VB6 and VB.NET, but work differently in both the languages (e.g. New keyword while declaring a variable etc.). And that's the exact reason why you won't find any converter that can convert the VB6 code to VB.NET with 100% surety.
-
Mar 6th, 2010, 10:10 PM
#11
Re: Converting code from one language to another
I found another web page that might be useful for converting the vb6.0 to c# constants.
http://www.netcoole.com/VB6TOCS/vbhtml/vbconsts.htm
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 7th, 2010, 05:13 AM
#12
Re: Converting code from one language to another
Hey,
That web page is all well and good, but in order to use it, you would need to include a reference to the Microsoft.VisualBasic assembly in your C# application, which I was never comfortable with doing.
Gary
-
Mar 7th, 2010, 05:30 AM
#13
Re: Converting code from one language to another
 Originally Posted by gep13
Hey,
That web page is all well and good, but in order to use it, you would need to include a reference to the Microsoft.VisualBasic assembly in your C# application, which I was never comfortable with doing.
Gary
Which site, the one I posted in post #11?
If you find or know of a better website/solution feel free to post it.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 7th, 2010, 05:43 AM
#14
Re: Converting code from one language to another
Yes, the link that you posted in post #11.
I don't know of any other web site, so I won't be posting any other link, the point that I was trying to make was that I would never include a link to Microsoft.VisualBasic, in a C# application that I was creating. In my opinion, there is no requirement to have to do this.
Gary
-
Mar 7th, 2010, 06:44 AM
#15
Re: Converting code from one language to another
Well, since I can't find any other website to do with the constants I will post something else that I found that maybe useful from the above Microsoft site.
http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx
Although, that is for VB.Net I would think there wouldn't be a big difference between the .Net languages.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 7th, 2010, 10:12 AM
#16
Re: Converting code from one language to another
The constants, methods etc. defined in the Microsoft.VisualBasic namespace is for old VB6 programs/programmers, that was created for their convenience or for them to easily migrate code from VB6 to .NET. You would normally not use it in new developments and certainly not in C#. However there is nothing stopping you to do so, just in case you want to.
-
Mar 7th, 2010, 01:13 PM
#17
Re: Converting code from one language to another
Hey,
This is the point that I was trying to make, but perhaps I didn't explain myself very well. Pradeep said it quite well, in that they are there for convenience, nothing else.
Gary
-
Mar 8th, 2010, 05:07 AM
#18
Re: Converting code from one language to another
I'm not actually looking at converting code at the moment just any useful resources in case I need to do it later on.
Last edited by Nightwalker83; Mar 9th, 2010 at 06:30 AM.
Reason: Fixed spelling!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|