Results 1 to 9 of 9

Thread: Upgrade VB 6 code to VB.NET

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2003
    Location
    C:\Windows\Microsoft.NET\Framework
    Posts
    574

    Upgrade VB 6 code to VB.NET

    There's this client who has some VB 6 code in an application for PDA development on Windows CE. Now, he needs this code to be converted into VB.NET code.

    I reckon Microsoft has been touting a host of upgrade tools since yore long before .NET was in beta. I've never touched .NET in real but for reading about it from an arm's length. Is is true that I could simply use an upgrade wizard in the .NET environment (VS.NET) that would take only a few seconds to convert all the VB 6 code to .NET? If it isn't, how do I go about it? What I mean here is that if it isn't, is there some other off-the-shelf component that would do the needful?

  2. #2
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    well,

    when you open up a vb6 project in vs.net, you will be asked if you would like to upgrade that project... Choosing yes, VS.NET will go through a bunch of processing, and pick through your code, updating the syntax everywhere...

    this in theory should work well, but there are a few quirks to it... for example, DoEvents as used in vb6 did not get upgraded to .NET for me, so i had to fix that up (i remember this from doing exactly what you want to do awhile back)...

    and of course if you used ocx's from vb6, you're still using ocx's that are written in vb6.... As for API calls, i'm not 100% sure how those are handled... maybe someone could elaborate on this portion of the process?

    But in the end, it really depends on how complex your vb6 project is... If you use a lot of 3rd party stuff, and api calls, it may be difficult to upgrade without a lot of work.... also keep in mind, i'm quite sure things such as ADO objects and whatnot are not the preferred method of doing things in .NET... ADO.NET is the preferred way, and vs.net cannot upgrade this part of it simply because there is a whole different mindset to programming with ADO.NET and controls (databinding and whatnot)...

    So realistically, vs.net can upgrade an old vb6 project, however some of the unorthodox methods that vb6 used to do things may be obsolete... they may still work upgraded, but they are not how .NET is intended to be used...

    If your application does a lot of database work, or uses alot of other specialized stuff, it may be worth considering recoding it in .NET instead of just letting vs.net upgrade... of course you may still want to upgrade it to see how well it works.. and at the very least, use that upgrade as a basis for recoding...

    it really depends on each case... hopefully you can work something out

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Do not use converter. Learn .NET and re-write it.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    IMO, cander is correct
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2003
    Location
    C:\Windows\Microsoft.NET\Framework
    Posts
    574
    Vow! thanks, guys. What a reputation the Upgrade Wizard has!

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Nonsense, the upgrade wizard perfectly converted the following project listed below:

    VB Code:
    1. Public Main()
    2.    Msgbox ("Hello World")
    3. End Sub

    And this one:

    VB Code:
    1. Public Sub Form1_Load()
    2.    Dim i as integer
    3.    For i = 0 to 10
    4.    Form1.Print ("HI")
    5.    Next
    6. End Sub

    You can successfully convert millions of Vb6 projects such as the ones listed above...

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    LOL.

    Actually the first one wont. It will use that Microsofft.VB namespace isntead of the proper MessageBox.Show

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2003
    Location
    C:\Windows\Microsoft.NET\Framework
    Posts
    574
    Unfortunately for me, my project doesn't look anything like that.

  9. #9
    Fanatic Member sbasak's Avatar
    Join Date
    Aug 2001
    Location
    Globe Trotter
    Posts
    524
    Usually for large projects even Microsoft recommends that you either write the application from scratch using VB.NET or keep it in VB6. [Often the cost of re-writing the application in .NET is almost 60% of the first development cost.]

    However, I think since your project is supposed to run in a PDA, the code won't be that complicated. Was your code written in AppForge's mobileVB? Then I think you can update it to .NET as well because as far as I know AppForge also supports .NET (though I myself didn't test it)!
    Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
    Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width