Differences between VB and VB. NET

Source: Internet
Author: User
Tags finally block

When I first came into contact with VB. NET, I always had a question mark-what is the difference between VB and VB. NET? After a preliminary study, I think we can understand the differences between VB and VB. NET through the following five main features of VB. NET.


I. VB. NET has two new forms: Windows Forms and web forms.

VB. NET allows you to create different types of applications. For example, you can create ASP. NET and ASP. NET
Web service applications can also create console applications and applications that run as desktop services.

In contrast, VB can only create windows forms.


Ii. VB. NET can access offline data sources through the new ADO. net

There is a big difference between the two in accessing the database. In specific programming, forms often contain database access controls. VB6.0 uses ADO controls and VB. NET uses ADO. Net controls. So what is the difference between ADO and ADO. Net?

(1) Some common types of ADO, such as recordset In ADO. net, and in ADO. net also adds many new types (such as data adapters) that cannot be directly found in traditional ADO );

(2) Traditional ADO mainly targets closely connected Client/Server systems, while ADO. net considers disconnected applications and introduces dataset, which indicates that each table of any number of associated tables contains a local copy of the set of rows and columns. If dataset is used, call the Assembly to process and refine its content when the database is disconnected, and then use the associated data adapter to submit the modified data back to the database.

(3) A significant difference between traditional ADO and ADO. NET is that the latter fully supports XML data presentation. In fact, the data obtained from the database is serialized as XML by default. If XML is transmitted between layers through standard HTTP, ADO. Net can break through the firewall restrictions.

(4) The most fundamental difference between the two is that ADO. Net is a hosted code library.


3. VB. NET has all the characteristics of object-oriented, including class, interface, encapsulation, inheritance and polymorphism;

When learning VB6.0, you can create a new class just like creating a new form and use it as a new object, but it can only be called a semi-object-oriented programming language. VB. NET is a fully object-oriented programming language in the real sense. In VB. NET, almost all things are related to objects, and it fully embodies three features of object-oriented: encapsulation, inheritance and polymorphism.


Iv. VB. NET supports structured exception handling and multithreading;

For error handling, use on in VB
Error Goto, while VB. NET uses try... catch... Finally block.

(1)VBError Handling Code display:

'Interception error on error goto err1 'a value for integer variable 40000 will overflow a = 100' then it will jump to err1 to execute error process' re-assign a value to a and message prompt AA = 40000 msgbox aexit sub 'error handling err1: msgbox "error! "& Vbcrlf &" error no.: "& err. Number &" error Description: "& err. Description": the next sentence of the error statement is returned to continue executing the remaining code resume next

(2)VB. NETError Handling Code display:

Try Dim I as integer = 0 dim iresult asinteger iresult = 1/I // capture MessageBox as an exception using ex. show (ex. tostring () Finally MessageBox. show ("the Finally block is executed") // try to end

VB6.0 supports multiple single-threaded units for concurrent processing and multi-task management. However, it does not support a free-threaded model, the working principle and programming mechanism of the multithreading mode are not applicable to VB6.0 at all. While VB. NET uses the CLR (Common
Language Runtime), which has many new features, one of which is to create a free-threaded application. It directly creates multi-threaded applications through the system. Threading class of the system.


V. VB. NET supports integration with other. NET Framework languages.

. Net Framework designs a Common Language System (CLS) and defines many standard data types ,. all advanced languages supported by netframework must support the definition of data types by the system at the same time.

When compiled into msil code, the Data Types of various advanced languages are converted into standard data types in the CLS system, such as VB. the integer data type defined in. NET is converted to system. int32 data type. The Int type in C # is also converted to system. int32 data type. In this way, variables in different languages can exchange information, which is the basic principle that. netframework supports mixed language programming.

The above is what I have learned for the time being. For the differences between VB and VB. NET, I hope you can give me more instructions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.