Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report