?
Solved

Upgrading from VB6 to V2005

Posted on 2006-04-03
6
Medium Priority
?
204 Views
Last Modified: 2013-11-13
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...?
0
Comment
Question by:AlHal2
  • 3
4 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 252 total points
ID: 16361819
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
0
 
LVL 14

Assisted Solution

by:nayernaguib
nayernaguib earned 248 total points
ID: 16362011
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
0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 16362093
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
0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 16362141
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
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Starting up a Project
Screencast - Getting to Know the Pipeline

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question