The next generation of Visual Basic, Visual Basic .NET is designed to be the easiest and most productive tool for creating .NET applications, including Windows applications, Web Services, and Web applications.
A D V E R T I S E M E N T
Visual Basic .NET also allows optional use of new language features. Inheritance, method overloading, structured exception handling, and free threading all make Visual Basic a powerful object-oriented programming language,while providing the traditional ease-of-use of Visual Basic development,.
Visual Basic .NET fully integrates with the Common Language Runtime(CLR) and the .NET Framework, which together provide language interoperability, simplified deployment, enhanced security, and improved versioning support.
Visual Basic .NET also allows optional use of new language features. Inheritance, method overloading, structured exception handling, and free threading all make Visual Basic a powerful object-oriented programming language,while providing the traditional ease-of-use of Visual Basic development,.
Using The System.Windows.Forms.Form class
The foundation class for all forms to be created is System.Windows .Forms.Form class.
In VB .NET,all the forms that are created are also inheriting from this base class.
For all the facilities needed for the form is provided by this class.
By using separate codes,we can add additional functionality.
In the .NET Framework, a number of new features have been added to the Controls and the Form Class.
Some of the new features quickly,we will see.
In the Microsoft website,for most detailed information is available.
Within the .NET Framework,we will see some of the members that have been added to Windows Forms Classes:
Do Things the Visual Basic .NET Way
Rather than .NET Framework objects,use Visual Basic runtime methods.
For instantiating classes,use the short method .
' Preferred.
Dim Employees As New Collection()
' Not preferred.
Dim Employees As Collection = New Collection()
In the AddHandler statement,do not explicitly instantiate a delegate.
Rather than the DllImport attribute to access native APIs,use the Declare statement .
Use of single-line If statement should be avoided.
With the variable name,declare the array length.
' Preferred.
Dim Buttons(4) As Button
' Not preferred.
Dim Buttons() As Button = New Button() {}
Rather than "On Error",use Try...Catch.
Rather than an AddHandlerstatement,use a Handles clause.
Instead of Str(),use CStr().
Instead of Int(),use CInt() .
Use Option Strict On, either as a statement
in each file, or as a project setting.
Use Option Explicit On, either as a
statement, or as a project setting in each file.
When applying an attribute,use the complete class name .
Rather than global methods in modules,use shared methods in classes .
Do not use type characters (%,$, and so on).
Do not use Call.
Difference between VB and VB.NET
VB.NET is what it got transformed into under the Microsoft .NET framework and VB is an obsolete language
However, VB.NET,C++.NET and C# all compile into the same .NET code - in a certain sense it is almost like they are the same language.
The greatest change in VB.NET and VB6 is of runtime environment. VB6 used the VB-Runtime while running the program but VB.NET uses the .Net Common Language Runtime (.Net CLR).In comparision to VB-Runtime,the CLR is much better designed and implemented.VB-Runtime interprets the code while the CLR uses better code translation through Just in Time compiler.In comparision to VB6,the CLR Garbage Collector is also more efficient one as it may detect cyclic references too.
VB6 was interpreter based language while VB.NET is a compiled language and the VB6 was not a type-safe language while VB.NET is a type safe language. There is no no magical type conversions in VB.NET and variant type happen in VB.NET
VB6 used �On Error Goto� syntax to handle exceptions at runtime. VB.NET uses the Try..Catch.At runtime,finally syntax is used to handle exceptions .
In VB6,a lot of code (like user interface code) was hidden from developer. In VB.NET no code is hidden from developer and you can access and control each part of your application
VB.NET has much enhanced object oriented support than VB6
VB6 does not allow developing the multithreaded applications but in VB.NET you can create multithreaded applications.
VB6 was only considered good for desktop windows application but in VB.NET you can also develop web applications, distributed applications, create .NET windows and web controls and components, write windows and web services.
In VB.NET,to read the meta-data of types,reflections is used and using reflection emit you can also generate code to invoke and define types at runtime.
VB.NET uses .NET framework class library along with specialized VB library (System.VisualBasic) as a standard library and so that the standard library for VB.NET is much enhanced and useful compared to VB6 standard library
VB.NET is platform independent because of .Net framework and programs written in VB.NET can run on any platform where .Net framework is present. The platform include both software (operating system) and hardware platforms.
VB.NET also supports language interoperability with various .NET compliant languages and this means that you can use and enhance the code written in other .NET compliant languages. Similarly the code written in VB.NET can also be used and enhanced by other .NET compliant languages. Although VB6 also provided this functionality through COM but it was limited and difficult to use and manage. VB.Net makes it easier because of the presence of Intermediate Language (IL) and Common Language Specification (CLS) of the .NET architecture.
VB6 uses COM (Component Object Model) as component architecture where as VB.NET uses assemblies as its component architecture and the Assemblies architecture has removed a lot of problems with COM including DLL-Hell and versioning problem.
Components created in VB6 (COM) need to update and make registry entries. VB.NET does not require any registry entry whic makes the deployment easier
VB6 used ASP to build web applications where as VB.NET uses ASP.NET to build web applications.
VB6 used record-sets and ADODB to implement data access applications where as VB.NET uses ADO.NET and datasets to build data access applications.And also the ADO.NET also supports the disconnected data access.
Advantages of Using VB.NET
Problems Solved effectively and easily.
Build Robust Windows-based Applications.
With new Windows Forms whic is avialable in the Windows operating system developers using Visual Basic .NET can build Windows-based applications that leverage the rich user interface features available. All the rapid application development (RAD) tools that developers have come to expect from Microsoft are found in Visual Basic .NET, including code behind forms and drag-and-drop design. In addition, new features such as automatic control resizing eliminate the need for complex resize code. New controls such as the in-place menu editor deliver visual authoring of menus directly within the Windows Forms Designer. Combined with greater application responsiveness, as well as simplified localization and accessibility and these new features in Windows Forms make Visual Basic .NET the choice for today's Visual Basic developers.
Resolve Deployment and Versioning Issues Seamlessly.
Visual Basic .NET delivers the answer to all of your application maintenance and setup problems. With Visual Basic .NET, issues with Component Object Model (COM) registration and DLL overwrites are relics of the past and side-by-side versioning prevents the overwriting and corruption of existing components and applications.
XCOPY deployment
XCOPY deployment enables Windows-based applications to be deployed to client machines simply by copying files into the desired application directory and in addition, the auto-downloading of applications for Windows makes the deployment of rich Windows-based applications as easy as deploying a Web page.
Create Web Applications with a Zero Learning Curve.
In Visual Basic .NET,using the new Web Forms Designer,Visual Basic developers can apply the skills they have today to build true thin-client Web-based applications. Drag-and-drop Web Form creation delivers Visual Basic for the Web while code behind forms enables developers to replace limited scripting capabilities of the past with the full power of the Visual Basic .NET language. New intelligent rendering capabilities and server-side Web Forms controls provide Web applications that render on any browser running on any platform. The new HTML designer delivers Microsoft IntelliSense� statement and tag completion for HTML documents. In addition, separation of HTML markup and code enable more efficient team-based development.