Strict VB.NET

by admin on September 17, 2009

Sometimes VB.NET is considered less powerful than C#. This isn’t true, all .NET languages have equal abilities.
The only difference is that VB.NET allows too many liberties in default configuration.

Old VB Compatibility Namespace

The first unnecessary thing consists of imported Visual Basic 6 Compatibility Namespace (Microsoft.VisualBasic). If you wish to become a true .NET programmer, you have to remove it. For almost every VB6 function there’s a replacement in .NET Framework. If you won’t use old compatibility functions, it will become possible to convert your code to other .NET languages without any problem.
So go ahead and remove it via Project, “ProjectName Properties“, “References” tab.

Remove VB Compatibility Namespace

Remove VB Compatibility Namespace

Compile Options. Warning Configurations.

In VB.NET, there’s no even a warning in regard to implicit type conversion, late binding or object assumption by default. This may lead to potential errors or low performance of the code.

If you want fast and reliable code, you have to change “None” at least to “Warning” or even “Error“.

The first three entries of configuration are the most important. They can be changed via “Project“, “ProjectName Properties“, “Compile” tab.

Change Default Warning Configurations in Compile Options Tab

Leave a Comment

Previous post: Open a specific key in regedit

Next post: Use WIA to retrieve images from scanner, digital camera or webcam using VB.NET and C#.