The difference between VB and vb.net

Source: Internet
Author: User
Tags bitwise

The difference between VB and vb.net

Source Address: http://blog.csdn.net/xjc1278003262/article/details/8805324

With the development of vb.net, most people abandon the use of VB6.0 and choose vb.net, below we will study the difference between VB6.0 and vb.net. Vb. NET is a development based on the Microsoft company launched in 2002. NET Platform Application development language, is also the Microsoft company highly recommends a kind of development. NET Platform Application development language. First of all, let's take a brief look at VB. NET and its previous version, and is currently the world's most users of the development language--VB 6.0 the main difference.


Brief Introduction to the main differences between VB6.0 and vb.net:

Although VB.net is a successor to VB 6.0, it seems to me that vb.net in addition to the syntax to retain the original traces of VB6.0, because they are almost 90% or more similar or the same. But in many other ways, VB. NET are very different from VB6.0. Perhaps it is these differences that make vb.net more powerful and life-like, but also difficult for VB6.0 programmers to transform into vb.net programmers. Because VB.net puts forward many new functions, concepts and viewpoints, mastering vb.net not only has to master the grammar, but also needs to understand and apply these new functions, concepts and viewpoints. Of course it needs to be mastered. NET Framework, understanding the CLR (Commonlanguage runtime, common language is in progress).



First, VB6.0 object-oriented content:















ii. categories of vb.net:



















Three, the difference of data type:




iv. Differences in variable declarations:

In VB6.0 , variable declarations have many limitations. One of them is that you cannot declare multiple variables in your peers. If you must declare more than one variable in a row, you must indicate the type of each variable, otherwise it will default to variant type.

[VB]View Plaincopyprint?
    1. <span style="FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;"   >1. Dim A1, A2 as Integer
    2. 2. Dim A3 As Integer, A4 as integer
    3. </span>


The A1 in the first row is variant, and A2 is an integer type. Both variables in the second row are of type integer.

vb.net supports peer declaration of multiple variables, for example:

[VB]View Plaincopyprint?
    1. <span style="FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;"   >1. Dim A1, A2, A3 as Integer </span>

The initialization of variables is another problem. Variables cannot be declared and initialized at the same time in VB6.0, while vb.net supports this feature

vb.net supports peer declaration of multiple variables, for example :

[VB]View Plaincopyprint?
    1. <span style="FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;"   >1. Dim A1, A2, A3 as Integer </span>


The initialization of variables is another problem. Variables cannot be declared and initialized at the same time in VB6.0, while vb.net supports this feature.



Five, the difference between the array:

The vb.net array has been significantly modified. In vb.net , you need to pay extra attention to array range issues. VB6.0 The default array has a lower bound of 0, so the number of elements in the array is added to the upper bound value of the array. The following array bounds are from a (0) to a (10), with a total of 11 elements:

[VB]View Plaincopyprint?
    1. <span style="FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;"   >1. Dim A (Ten) as single </span>

You can use Optionbase to change the nether value to 1. In vb.net, arrays, like C + +, have a nether value of 0 and do not support option Base.



Six, Boolean operators

theand, or, or XOR statements in VB6.0 are bitwise-operators. In vb.net, they are Boolean operators. Performing these operations will return true or false. Vb. NET introduces new operators to perform bitwise operations.



VII. Set statements are not supported

VB6.0 uses the SET statement to assign an object. For example :

[VB]View Plaincopyprint?
    1. <span style="FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;"   >1. Set myObj = new MyObject
    2. 2. Set a = b
    3. </span>

In vb.net , you do not need to assign objects using set. For example :

[VB]View Plaincopyprint?
    1. <span style="FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;"   >1. MYOBJ = new MYOBJ ()
    2. 2. A = b
    3. </span>



Viii. new and Nothing keywords

in VB6.0, the as new and nothing keywords are used to declare an object and initialize it.  

VB.net does not support the implicit creation of an object.



ix. data Access :

Different points are mainly manifested in: data access technology, data access specific implementation methods and data binding differences.

In the data access technology, VB 6.0 is accessed through ADO (Active X data object, i.e., Active X). It also provides two data access technologies for RDO (Remote Data Objects) and DAO (data Access Objects) to ensure compatibility with earlier versions. In VB. NET is to use ADO to access the database, ADO is part of the. NET Framework, and its corresponding class library is a true subset of the. NET Framework SDK. There are many differences in concepts, functions, and implementations between the two technologies: ADO and-ADO. Due to space constraints, there is no introduction. In fact, ADO can also be used to access the database in vb.net, but ADO appears as a COM component in vb.net and can be used in vb.net by adding references. The process of adding references is actually interoperating with COM components. The interoperable COM component, which is not a COM component in its previous sense, is transformed into a. NET class library that can be used directly by vb.net.

In the implementation of data access, VB 6.0 data access is mainly two methods: one is in the program design phase, you can bind the data source to the ADODC control or use the data environment; You can programmatically create recordset Recordset objects and Exchange data with Recordset objects. There are also two ways to implement data access in vb.net: One is to create, configure, and generate datasets by creating, configuring, and DataAdapter Data adapters in the program design phase, and in the run, programmatically create, configure, and create data sets dynamically.

On data bind, data binding is implemented in VB 6.0 by setting the following properties of the control: datachanged, DataField, DataFormat, DataMember, and DataSource. The control's display property is typically bound to the corresponding field in the data source. In vb.net, data binding can be applied much more broadly, and any property of any control can be bound to any structure that contains data in vb.net.



10. Web Development :

VB iscreated in a Web application by using Active Server Page (abbreviated as ASP). In ASP, writing Web page is not pure VB language, but VB Script language--vbscript. In vb.net, you use ASP. NET technology to write Web pages. The use of ASP is no longer a scripting language, but a real meaning programming language, which can be vb.net. have developed ASP page friends are clear, although writing ASP page to development tool requirements is very low, but because it is a process-oriented development, so a little more complex ASP code is messy, which gives the program design, debugging, modification brings trouble. While VB.net is built on a new framework, vb.net fully supports Web programming. Web-based features such as ASP. NET Web applications, XML Web services, and so on, make vb.net development Web pages similar to developing Windows programming, and Web page code does not appear to be structured.



11. Component Creation :

while writing applications using VB 6.0 and vb.net, you can add components to your application by dragging them through the selection of components from the Toolbox, but there is a fundamental difference in the implementation mechanism. In VB 6.0, the components created in the application are all COM components that can be used in COM applications, ActiveX controls, ActiveX-type DLLs, and ActiveX-type EXE. In vb.net, the components that are dragged into the form are based on inheritance, inheriting from the corresponding class in the SDK provided by the. NET Framework, and then adding the functionality to the design form after the instantiation. These procedures can be found in the source code of the vb.net. Vb. Each component used in net is derived from the component or control base class.

Of course there are many differences between VB6.0 and vb.net, such as: VB 6 only provides single-threaded mode, does not support multithreading. And in vb.net full support multithreading. New functions such as structured exception handling are also added in vb.net.

The difference between VB and vb.net

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.