VB and VB.NET - Difference


This is an old issue but very frequently we come across the same query. Particularly when we require the application (OCX) migration from VB.

What  are some of the basic differences between VB & VB.NET?
Answer:

The following section enlists some of the issues I came across when encountered with a similar migration requirement. These differences are mostly in reference to VS2005.

1. VB.NET provides managed code execution that runs under the Common Language Runtime (CLR) resulting in robust, secure and stable applications. All features of the .NET framework are readily available in VB.NET.

2. VB.NET is entirely object oriented. This is a major addition that VB6 didn’t have.

3. The .NET framework comes with ADO.NET, which follows the disconnected paradigm, i.e. once the required records are fetched the connection no longer exists. It also retrieves the records that are expected to be accessed in the immediate future. This enhances Scalability of the application to a great extent.

4. Error handling has changed in VB.NET. The Try-Catch-Finally block has been introduced to handle errors and exceptions as a unit, allowing appropriate action to be taken at the place the error occurred thus discouraging the use of ON ERROR GOTO statement. Code maintainability is enormously helped with this addition.

5. The Event Log Model, OLE automation and DDE is not available in VB.NET. We need to use other kind of inter-process communication instead of DDE & OLE.

6.The properties, events and attributes for Form, Controls (list box, command button i.e. mask colour property etc.) has undergone a comprehensive change. It is better to refer to the msdn for further details. eg. The FileCopy replaced by File.Copy, Kill method replaced by File.Delete etc.

7. The property bag approach to persist data between various instances in VB is completely taken over by the Serialization concept.

8. VB.NET is free threading as opposed to the VB single-threaded apartment feature. In many situations developers need spawning of a new thread to run as a background process and increase the usability of the application. VB.NET allows developers to spawn threads wherever they feel like, hence giving freedom and better control on the application.

9. Security has become more robust in VB.NET. In addition to the role-based security in VB6, VB.NET comes with a new security model, Code Access Security (CAS). This security controls on what the code can access. For example you can set the security to a component such that the component cannot access the database. The CASPOL.EXE is the application with which this can be controlled to the widest extent. This type of security allows building components that can be trusted to various degrees.

10.The CLR takes care of garbage collection i.e. the CLR releases resources as soon as an object is no more in use. This relieves the developer from thinking of ways to manage memory. CLR does this for them.

11. VB 6.0 supported Null propagation — when Null was used in an expression, the result of the expression would also be Null. Null propagation is no longer supported in VB.NET.
In Visual Basic 6.0, the Null keyword indicated that a variable contained no data and the IsNull function was used to test for Null. In Visual Basic .NET, the Null keyword is a reserved word and has no syntactical value. The IsNull function is no longer supported.
Null is converted to DBNull, and IsNull is converted to IsDBNull. The behavior of DBNull is slightly different than that of Null. Null could be used in functions and assignments; DBNull cannot.

Comments

Popular posts from this blog

Automatic Replenishment ~ Warehouse Management (WM) in SAP

Teradata - Month End Date

Cross Domain Webix Post