Upgrading from VB6 to V2005

I asked a question today about VB Express 2005 vs the professional version.  That question was:

I'm a VB6 programmer and want to learn VB 2005.  I have a CD with VB 2005 express.  Is it worth practising on Express or should I fork out for the professional Edition?
My next question is:

What can I do in Vb 2005 that I can't do in Vb6.  In VB6 I already have bits of code that I reuse as needed.  What practical difference can it make e.g. better API calls, a sorting algorithm, more functions for working with strings and dates...?
AlHal2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Arthur_WoodCommented:
1) with .NET, you should not need ANY API calls, except possibly to third party libraries - ALl of eht Microsoft APIs are already built into  the .NET Framework.

2)  You will find that it is not so much what you can do with .NET that you can't do with VB^, but rather that the way you do it in .NET is many times VERY VERY different - you will need to re-learn a lot of what you have been doing with VB6.
   a) EVERYTING, repeat, EVERYTHING in .NET is an object, and thus has Properties and Methods.

       for example, a variable declared as String has a Replace METHOD, which serves to completely 'replace' the VB6 Replace FUNCTION:

      Dim MyString as String = "This is MY string"

      MyString.Replace ("MY", "John's")

      MyString now is "This is John's string"

     Integer variables have a ToString method, which can serve to format the resulting String (thus replacing the VB6 Format FUNCTION)

     Dim MyInt as Integer = 12345;

     MessageBox.Show( "The Value is " & MyInt.ToString("#,##0"))

(this could also be doe as :

     MessageBox.Show("The Value is {0,"#,##0}", MyInt)

Notice the NEW MessageBox function in .NET - which replaces the VB6 MsgBox.


These are just a few of the significant differences.

Please do yourself a BIG favor, and do NOT attempt to 'upgrade' your existing VB 6 code to .NET, using the UPGRADE Wizard - you will create far more work for yourself, trying to fix the 'errors' that will be reported with the 'upgrade' , which will require far more time to fix, that you would spend, re-wrtiting the functionality of the VB6 code, in 'proper' .NET, to begin with.  

I would strongly advise you to forget EVERYTHING - well, almost EVERYTHING, since the Syntax of VB.NET is quite similar to the Syntax of VB.NET, but that is about as far as the similarities go - that you ever thought you knew about VB, because the sooner you do that, and adapt to the VB.NET way of doing things, the better.  VB.NET is a PURE Object Oriented language, where VB6 was 'Object Based' - and there is a huge differencve between them, simply because of that distinction.  VB.NET is not simply a 'better' version of VB6.  It is a completely DIFFERENT animal.

AW

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nayernaguibCommented:
In general, .NET versions of Visual Basic (2002, 2003, 2005), have the following advantages over VB 6.0:

1. A *very* rich class library (the same class library accessible from C# and C++ .NET).
2. Direct interoperability with components created using other .NET languages.
3. Enhanced versions of components/technologies (such as ADO .NET and ASP .NET).
4. Portability to other platforms running the .NET Framework (other Windows/non-Windows operating systems, Pocket PC's, etc...). Porting the .NET Framework to non-Windows operating systems has not been achieved yet.
5. You get the full-featured compiler for free (it gets installed with the .NET Framework). Visual Studio 2005 even has free versions of the IDE's (Express Editions).

As for your other question, the Express Edition is just a limited "Integrated Development Environment". It provides less development "facilities" (yet already very powerful) than other versions of Visual Studio. However, the compiler is the same, and the available laguage API's are also the same, etc...

In brief, you can develop powerful VB .NET applications using the Notepad, and the command line compiler!! So take advantage of the freely available Express Edition to explore the .NET environment.

_______________

  Nayer Naguib
nayernaguibCommented:
I suggest that you take a while writing miscellaneous VB .NET applications before you start upgrading your VB 6.0 code to VB .NET. Although both are *very* easy to program, you need to be familiar with .NET programming before you start upgrading your old code. This is because you will not be modifying your code on a line-by-line basis. For example, you may have 10's of lines of VB 6.0 code that would be translated to a single method call to an object of some existing class in the .NET Framework Class Library.

_______________

  Nayer Naguib
nayernaguibCommented:
The .NET Framework does *not* encapsulate *every* existing Win32 API call, just the most frequently used by programmers.
For example, to set the transparency of a form in .NET, you just write something like this:

  myForm.Opacity=0.x 'where x is the percentage of opacity

But to register your application as an application desktop toolbar (a form that will dock to some edge of the screen and shrink the desktop), you still need to call Windows API's.

_______________

  Nayer Naguib
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.