Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Equivalent syntax VB 6.0 vs VB.NET 2008 1

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,569
US

We are about to move our application from ‘classic’ VB 6.0 to VB.NET 2008, so there will be a lot of re-writing of our code into this new language.

Is there any place on the Web where I can find the equivalent code from VB 6 to .NET?

Something like:
Code:
       [blue]VB 6.0[/blue]                           [green]VB.NET 2008[/green]

[blue]Left$("Some text here", 5)[/blue]      [green]Strings.Left("Some text here", 5)[/green]
[blue]cboCounty.AddItems "One"[/blue]        [green]cboCounty.Items.Add("One")[/green]
[blue]cboCounty.ListIndex = 0[/blue]         [green]cboCounty.SelectedIndex = 0[/green]
[blue]cboCounty.Clear[/blue]                 [green]cboCounty.Items.Clear()[/green]
[blue]Me.MousePointer = vbHourglass[/blue]   [green]Me.Cursor = Cursors.WaitCursor[/green]
[blue]Me.MousePointer = vbDefault[/blue]     [green]Me.Cursor = Cursors.Default[/green]
[blue]Debug.Print[/blue]                     [green]Debug.Write or Debug.WriteLine[/green]

etc.

I did find some of them by Google, but this is a ‘one-at-the-time’ deal and it is getting a little old.


Have fun.

---- Andy
 
I haven't seen anything out there.

First thing to consider is the fact that VB6 vs. VB.Net & later is not just a difference in the syntax used. The approaches you will take to accomplish the same task in each language will be different at times--so you really won't end up with a line by line translation of your old code. I would imagine VB 2008 still has the upgrade from VB6 wizard included. You could try that--not to port the project to .Net with the wizard alone--but to do some of the translation work to copy and paste to your new version as needed.

The second thing to consider is if you are simply rewriting the existing application to a new language, that's a lot of work that may not be worth it from a business perspective. Because bottom line, you will have to go through every line of code regardless if you find a translation tool, use the wizard to assist you, or rewrite it all by hand.
 

Thank you RiverGuy, I do realize that moving to VB.NET will not be:
Replace “my VB 6.0 line of code’ with ‘equivalent in VB.NET code’

But the most trouble right now is to find some simple information, like:
I know how to do Replace in VB 6, where do I find it in VB.NET? On line help is not helpful at all, but that’s not a surprise any more with Micro$oft :-(

As far as “VB 2008 still has the upgrade from VB6 wizard included” – the wizard is totally useless, IMHO.

So that’s why I am looking for a place with more of what I stated in my OP, that’s all.


Have fun.

---- Andy
 
I would suggest two things. One, use the upgrade wizard to convert your code, as crappy as it may be. Then use any diff tool to evaluate the differences between the original VB6 and the new VB.Net. You can use this as a learning tool to understand line by line translation.

My second suggestion is that you don't upgrade a line of code until you have a strong understanding of how to create robust applications in .Net. Speaking from experience, you will not have a successful upgrade unless you understand the way the application ought to built from the ground up in .Net. You could hack your way through a small project but larger projects just can't be approached in this manner.
 
There is a useful tool within VS 2008 (VB at least) which may help to point you in the right direction in understanding how to convert VB6 code to VB Net.

Open a project in VB NET 2008 (express version will do), Open a form and view source code. Then, select Tools -> Upgrade Visual Basic 6 Code... Paste into the dialog the VB6 code you are unsure about, then click the Upgrade Button.

Clearly, this is not a bulk code converter but, it has certainly helped me get a handle on how .NET works compared to VB6

Hope you find it useful
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top