Conversion from Visual Basic 6.0 to Visual Basic. NET (1)
Microsoft Visual Basic. NET is Microsoft Visual Basic? Later versions, it was re-designed based on the. NET Framework, you can use it to easily create for Microsoft Windows? The next-generation applications of the operating system and Web. Visual Basic. NET makes it easy to visually develop Web applications, Web services, Windows applications, and server-side components. In addition, Visual Basic. NET uses the XCOPY Deployment Solution for Windows applications, so that you do not have to worry about the DLL version. With the release of Visual Basic. NET, "DLL nightmare" will become a thing of the past.
When designing Visual Basic. NET, we focus on the requirements of Visual Basic developers around the world. The Visual Basic language is now a real object-oriented language and supports implementation inheritance. The Form Designer supports visual inheritance and contains new features such as automatic resizing of the form, resource localization, and support for access options. Currently, data tools continue to support XML data and can be used together to bind and disconnect data during design hours. In addition, Visual Basic. NET is directly created based on the. NET Framework. Therefore, all platform features can be used and can work together with other. NET languages.
While releasing these features, we made changes to several aspects of the product. This document describes some changes from Visual Basic 6.0 to Visual Basic. NET and explains the reasons for these changes. This article also describes the functions of the Visual Basic. NET Upgrade Wizard. It is a tool provided as part of the product and helps you upgrade existing applications to Visual Basic. NET.
For more information about upgrading from Visual Basic 6.0 to Visual Basic. NET, see the White Paper "Preparing to upgrade a Visual Basic 6.0 Application to Visual Basic. NET ). This White Paper introduces the upgrade process and provides constructive suggestions for the smooth upgrade.
Language
Variant
Visual
Basic 6.0 Variant is a special "common" data type that can contain all types of data except fixed-length strings. Object variables are used as pointers to objects. The default data type is Variant.
Visual Basic. NET
The Common Language Runtime (CLR) uses an Object as the common data type. Visual Basic. NET does not continue to use Variant as a common data type, but chooses to use CLR naming rules to avoid confusion during cross-language development. Using only one common data type simplifies the type system. The default data type is Object.
Upgrade
Wizard
The following code changes the Variant data type to Object:
Dim x As Variant
After the upgrade, it will be changed:
Dim x As Object
Integer and Long
Visual
The Basic 6.0 Long variable is stored as a 32-bit number with a symbol, and the Integer variable is stored as a 16-bit number.
Visual Basic. NET
The Long variable is stored as a signed 64-bit number, the Integer variable is stored as a 32-bit number, and the Short variable is stored as a 16-bit number. In 32-bit systems, 32-bit integer operations are faster than 16-bit and 64-bit integer operations. This means that Integer will be the most effective and basic numeric type.
Some. NET Framework technologies are based on modern 32-bit and 64-bit technologies, so it is wise to update the data size based on new technologies.
Upgrade
Wizard
Modify the type of the variable, so the following code:
Dim x As IntegerDim y As Long
After the upgrade, it will be changed:
Dim x As Dim y As Integer
Currency
Visual
Basic 6.0 Visual Basic 6.0 supports the Currency data type. You cannot declare a variable of the Decimal type (although a variable can have a child type of Decimal ).
The Currency variable is stored as a 64-bit number in integer format. It is represented as a fixed number on a scale of 10,000. The value is 15 digits on the left of the decimal point and 4 digits on the right. This representation can represent numbers in the range of-922,337,203,685,477.5808 to 922,337,203,685,477.5807.
The Decimal variable is stored as a signed 96-bit integer, And the scale is different from the power of 10. The Scale Factor of the 10 Power indicates the number of digits on the right of the decimal point, ranging from 0 to 28. When the index is 0 (no decimal places), the maximum possible value is +/-79,228,162,514,264,337,593,543,950,335. When the index is 28, the maximum value is +/-7.9228162514264337593543950335, and the minimum non-zero value is +/-0.0000000000000000000000000001.
Visual Basic. NET
Currency data types are not accurate enough to avoid rounding errors. Therefore, a Decimal data type is created.