Converting VB6 codes to VB.NET

sharkapl

New member
Joined
Sep 4, 2006
Messages
1
Programming Experience
Beginner
Hi all i am new here
1) Just want to ask if is it possible to convert VB6 Codes to VB.NET. If its possible how ? What are the steps to do.

2) Also is VB6 and VB.NET multi-lingual

Thanks alot
 
Hi

1) Just want to ask if is it possible to convert VB6 Codes to VB.NET. If its possible how ? What are the steps to do.
To convert VB6 code to VB.NET you simply open your vbp project file in VB.NET and the conversion wizard should then start.

However, having said this, it is usually better to re-write your project as the conversion code invariably requires a lot of work to get working and it also uses the Visual Basic compatibility layer which means that your code will still make use of a lot of VB6 syntax which doesn't teach you how to do things properly in .NET.

If you are new to VB.NET then I seriously recommend that you take a small project and re-write it as it will help you later when trying to convert larger projects.

HTML:
2) Also is VB6 and VB.NET multi-lingual
Not quite sure what you mean here, but if you are asking if the syntax in VB.NET and VB6 are similar then I would say that they are when using the Visual Basic compatibility layer. But once you start doing things the ".NET way" you will see that the syntax is quite difference.

For example, in VB6 you might use the Mid statement to grab string contents, whereas in VB.NET you would use the SubString method of the String object. Likewise, converting a string to a Long would require use of the CLng function in VB6, whereas in VB.NET you would make use of the casting methods such as CType and DirectCast.


HTH
 
There is an uprade wizard included with .Net 2005, however from what i've heard it can be more trouble than it is worth. In most cases i've heard about it is worthwhile just re-writing the whole thing, that may not be what you wanted to hear though.

http://support.microsoft.com/kb/309617/EN-US/

Multi-Lingual? In what respect?

EDIT: Looks like djjeavons beat to the button there:) But just one thing to add. When converting types like the example djjeavons mentioned, it is worthwhile using the Convert Class i.e..

VB.NET:
Dim I as integer = Convert.ToInt32(Some string)

Much faster than using the inline statements such as CInt, CStr etc...

Also there are other methods, that maybe a bit 'safer' such as Integer.TryParse etc...
 
Back
Top