VB6 vs VB.net
Data Type
VB6 | VB.NET | Comments |
Integer | Short | 16 bits |
Long | Integer | 32 bits |
N/A | Long | 64 bits |
Variant | N/A | Use the new ‘Object’ data type |
Currency | N/A | Use Decimal in VB6 or Decimal or Long in VB.NET |
N/A | Decimal | Available* in VB6. Native in VB.NET |
String | String | VB.NET doesn’t support fixed length strings |
– VB.net does not support Variant and Currency data type so use Object data type
– For currency, VB.net uses decimal data type and VB can also use the decimal data type. VB can’t declare a variable as decimal but can declare it as variant and then use cDec function to make its subtype decimal
Passing Parameters
– VB is using 2 methods: pass by reference and pass by value
– VB.net is using pass by value
Variable Declaration
– Always declare a variable in separate lines.
– Eg:
Dim lngOne As Long
Dim lngTwo As Long
If declares like this,
Dim lngOne, lngTwo As Long
declares lngOne as a Variant (which is not supported in .NET) and lngTwo as a Long.
New Commands and Keywords
– VB.NET introduces many new keywords
Array
– VB, array(5) gives index 0 to index 5
– VB.net, array(5) gives index 0 to index 4
Default Properties
– VB allows referencing default properties without specifying the name of property
– VB.net does not allow it
Let and Get Properties
– VB.Net no longer has Let properties
Data Access Method
– VB.net, all bound controls work with ADO only
Windows Forms
– VB.net is using windows forms replacing the VB6 Forms
More details, http://www.thescarms.com/vbasic/VB6vsVBNet.aspx