Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of the comparison between VB.NET language and VB language

Shulou Source: shulou.com Published: 2022-06-02 08:56:52 09月19日 Update

The editor will share with you an example analysis of the comparison between VB.NET language and VB language. I hope you will gain something after reading this article. Let's discuss it together.

VB.NET grammatical comparison

The old syntax the new syntax states that the form loads events, and the class initialization event Sub New procedure Sub New is called a constructor (Constructor), which can have parameters.

The Property Let Property Set Let keyword is no longer valid.

Currency Decimal in VB6, Decimal is a subtype of Variant, but it is an inherent data type in .NET. The Currency data type is no longer supported in .NET.

Variant Object VB.NET 's Object data type has the capability of both VB6 Object and Variant types.

The change in Debug.Print Debug.Write Debug.WriteLine is just a simple change in name: from Print to Write and WriteLine.

Wend End While VB.NET recommends using While loops instead of Do loops.

In order to match the data types of VB with those of other .NET languages, Microsoft modified the representation of integer data types and added a new data type. These changes are particularly important for methods that make external calls (such as API calls). For example, if the called function requires a 32-bit integer argument, it should be declared Long in VB6 and Integer in VB.NET.

Data types related to integers

Names in length VB6 and earlier versions of VB.NET

16 bit Integer Short 32 bit Long Integer 64 bit (none) Long

In VB.NET syntax, Microsoft reduces many keywords originally used in VB6 and replaces them with "frame class". The reason for this replacement is that the functionality in the framework class is valid for all .NET languages. The following table lists some of the affected keywords. Keywords to be replaced

VB keywords location methods / attributes in the VB.NET namespace

Circle System.Drawing.Graphics DrawEllipse

Line System.Drawing.Graphics DrawLine

Atn System.Math Atan

Sgn System.Math Sign

Sqr System.Math Sqrt

Rnd Microsoft.VisualBasic.Compatibility.VB6 Rnd

Round Microsoft.VisualBasic.Compatibility.VB6 Round

Lset System.String PadRight

Rset System.String PadLeft

DoEvents System.Winforms.Application DoEvents

VarType System.Object GetType

(returns an object of class Type, which contains attributes that can extract information)

After reading this article, I believe you have some understanding of "sample Analysis of the comparison between VB.NET language and VB language". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Type data language key keyword name method syntax integer example analysis valid event parameter property frame article change loop important Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Redmi NVidia Shulou Tech Info Docker