VB6 to VB.Net Beginners Tutorial
This tutorial is intended to show some of the differences VB.Net has introduced over VB6. This tutorial is aimed at the VB.Net beginner. It will show some of the major differences VB.Net has introduced over VB6. This tutorial does not cover changes in the IDE, only basic code changes.
Variable Declaration
Variable types in VB.Net have altered when compared to VB6. Below is a table listing the variable types and the associated value boundaries for VB.Net
The Variant data type is no longer supported in VB.Net. The Object type can be used in cases where the data type is unknown like Variants were used in VB6. As with VB6 and Variants, the Object type should be avoided.
Option Explicit / Option Strict
Option explicit is now defaulted to on instead of off as in VB6. To turn Option Explicit off (even though you shouldn’t) type the following at the top of the form.
Option Explicit Off
If a variable is not declared in your form it will be created as an Object if the above statement is used.
Option Strict is a new command in VB.Net. This statement forces you to convert variable types to the same type before they can be compared. To convert variable types use commands such as CInt, CLng, CStr, CBool and CType functions.
Get pdf VB6 to VB.Net Beginners Tutorial
Related Tutorial
Tags: boundaries, clng, code changes, ctype, variable declaration, variable types, variant data type
Comments
Leave a Reply