What is the difference between VB and VB.NET?

45,572

Solution 1

If you're making a choice for a new project then the pertinent points are:

  • VB6 is legacy (released 1998, the IDE is no longer supported, and the runtime only supported for the lifetime of Win8)
  • VS2008 doesn't support VB6
  • VB.NET is a modern language, supported in VS2008

I'd say there are very few reasons (if any!) to choose VB.OLD over VB.NET.

If you're "just interested" then the Wikipedia article on each language is quite informative, but in a nutshell they are quite different languages that have superficially similar syntax. VB had its own runtime, where VB.NET is one of many languages that use the more modern .NET Framework.

Solution 2

There are a lot of differences.

  • The greatest change in VB6 and VB.NET is of runtime environment. VB6 used the VB-Runtime while VB.NET uses the .Net Common Language Runtime (.Net CLR). The CLR is much better designed and implemented than VB-Runtime. The CLR uses better code translation through Just in Time compiler while VB-Runtime interprets the code. The CLR Garbage Collector is also more efficient than VB6 one as it may detect cyclic references too.
  • VB6 was interpreter based language while VB.NET is a compiled language
  • VB6 was not a type-safe language while VB.NET is a type safe language. There is no variant type in VB.NET and no magical type conversions happen in VB.NET

some other differences:

Inheritance

VB.Net supports inheritance by allowing you to define classes that serve as the basis for derived classes. Derived classes inherit and can extend on the properties and methods of the base class. They can also override inherited methods with new implementations of the base class. All classes created with VB.Net are inheritable by default. Because the forms you design are really classes, you can use inheritance to define new forms based on existing ones. For details, see Inheritance in Visual Basic.

Exception Handling

VB.Net supports structured exception handling, using an enhanced version of the Try...Catch...Finally syntax supported by other languages such as C++. Structured exception handling combines a modern control structure (similar to Select Case or While) with exceptions, protected blocks of code, and filters. Structured exception handling makes it easy to create and maintain programs with robust, comprehensive error handlers. For details, see Introduction to Exception Handling.

Overloading

Overloading is the ability to define properties, methods, procedures, or operators that have the same name but use different data types. You can use overloaded procedures to provide as many implementations as necessary to handle different kinds of data, while giving the appearance of a single, versatile procedure. For details, see Overloaded Properties and Methods.

Overriding Properties and Methods

The Overrides keyword allows derived objects to override characteristics inherited from parent objects. Overridden members have the same arguments as the members inherited from the base class, but they have different implementations. A member's new implementation can call the original implementation in the parent class by preceding the member name with MyBase. For details, see Overriding Properties and Methods.

Constructors and Destructors

Constructors are procedures that control initialization of new instances of a class. Conversely, destructors are methods that free system resources when a class leaves scope or is set to Nothing. VB.Net supports constructors and destructors using the Sub New and Sub Finalize procedures. For details, see Object Lifetime: How Objects Are Created and Destroyed.

Data Types

VB.Net introduces three new data types. The Char data type is an unsigned 16-bit quantity used to store Unicode characters. It is equivalent to the .NET Framework System.Char data type. The Short data type, a signed 16-bit integer, was named Integer in earlier versions of Visual Basic. The Decimal data type is a 96-bit signed integer scaled by a variable power of 10. In earlier versions of Visual Basic, it was available only within a Variant. In addition, Visual Basic now supports unsigned integer data types (UShort, UInteger, and ULong), as well as the signed type SByte. For details, see Data Types in Visual Basic.

Interfaces

Interfaces describe the properties and methods of classes, but unlike classes, interfaces do not provide implementations. Use the Interface statement to declare interfaces; use the Implements statement to write code that puts the items described in the interface into practice. For details, see Interfaces in Visual Basic.

Delegates

Delegates are objects that can call the methods of objects on your behalf and are sometimes described as type-safe, object-oriented function pointers. You can use delegates to let procedures specify an event handler method that runs when an event occurs. You can also use delegates with multithreaded applications. For details, see Delegates and the AddressOf Operator.

Shared Members

Shared members are properties, procedures, and fields that are shared by all instances of a class. Shared data members are useful when multiple objects need to use information that is common to all objects. You can use shared class methods without first creating an object from a class. For details, see Shared Members in Visual Basic. References

You can use References to use objects defined in other assemblies. In VB.Net, references point to assemblies instead of type libraries. For details, see References and the Imports Statement.

Namespaces

Namespaces prevent naming conflicts by organizing classes, interfaces, and methods into hierarchies. For details, see Namespaces in Visual Basic.

Assemblies

Assemblies replace and extend the capabilities of type libraries by describing all the required files for a particular component or application. An assembly can contain one or more namespaces. For details, see Assemblies.

Attributes

You can use attributes to provide additional information about program elements. For example, you can use an attribute to specify which methods in a class should be exposed when the class is used as a XML Web service. For details, see Attributes in Visual Basic.

Multithreading

You can use VB.Net to write applications that can perform multiple tasks independently. A task that can hold up other tasks can execute on a separate thread, a process known as multithreading. By causing complicated tasks to run on threads that are separate from your user interface, multithreading makes your applications more responsive to user input. For details, see Multithreaded Applications.

Bit Shift Operators

VB.Net now supports arithmetic left- and right-shift operations on integral data types (Byte, Short, Integer, and Long) as well as on unsigned types (UShort, UInteger, and ULong). Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. The corresponding assignment operators are provided as well. For details, see Bit Shift Operators and Assignment Operators.

Loop Variable Declaration

You can use VB.Net to declare a loop variable as part of a For or For Each loop. You can include an As clause for the variable in the For or For Each statement, provided no variable of that name has been declared outside the loop. The scope of a loop variable declared in this manner is the loop itself. For details, see For...Next Statement (Visual Basic) and For Each...Next Statement (Visual Basic).

Further informations:

Edit: as commented some features like constructors were already supported in VB6(in a different way), have a look at the last link what takes that more into account

Solution 3

Classic VB doesn't support most OOP features, while VB.NET does.

Solution 4

Major differences are Version Number and Object Orientation.

Up to version 6, it was known as VB. From version 7, which was released with .Net 1.0, it was known as VB.NET.

It was completely revamped in version 7 to become more streamlined with .Net Framework (CLI & CLS compatibility) and other languages such as C# and Java.

In this transition, several changes caused broken backward compatibility with previous versions. That is why Microsoft provided a few tools in Visual Studio to convert old VB6 apps into .Net.

Share:
45,572
user287745
Author by

user287745

Updated on July 23, 2022

Comments

  • user287745
    user287745 almost 2 years

    What is the difference between VB and VB.NET?

    Explanation with examples is preferred.