[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

What is the purpose of the Microsoft.VisualBasic namespace?

Posted on 2007-04-04
6
Medium Priority
?
230 Views
Last Modified: 2010-04-23
Is the Microsoft.VisualBasic namespace in VB.NET 2003 and VB 2005 just for backwards compatibility with VB6? Is it something I should be trying to avoid and be using equivalents in .NET?
0
Comment
Question by:SETP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 600 total points
ID: 18849507
Depends on if your projects still have some vb6 dependencies.
It's more for a transition from vb6 to .net.
I wouldn't say you should be trying to 'avoid' it, but you can move away from it by using .net terminology in your code instead...
0
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 600 total points
ID: 18849667
as an example, if you are coming from a VB6 background, then you are quite familiar with MsgBox.

MsgBox is supported in .NET, but requires including a reference to the Microsoft.VisualBasic namespace.  

The .NET equivalent is MessageBox.Show() - which does not require the reference to the Microsoft.VisualBasic namespace.

It is strongly advised to use MessageBox.Show() in all VB.NET applications.

AW
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 800 total points
ID: 18851695
Not everything in Microsoft.VisualBasic is for backwards compatability!...

Most of this stuff is for legacy code:
http://msdn2.microsoft.com/en-us/library/c157t28f(vs.80).aspx

BUT you have entirely NEW classes/functionality being added to that namespace as well.  Some of the new namespaces were placed there to support the new "My.XXX" functions in VB.Net 2005.

The new Application Model was placed in there:
http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.applicationservices.aspx
You can do things easily with the new application model that before required complex interprocess code.  It even has new events that allow you to do things before the first form ever fires up.

The new Devices support is there:
http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.devices(vs.80).aspx

The FileIO namespace has new utilities (like TextFieldParser) that are pretty nice:
http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.fileio(VS.80).aspx
It also has the backbone of the My.Computer.FileSystem.XXX namespace which gives you alot of "one liners" that allow you to work with files, etc...

Logging:
http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.logging(VS.80).aspx

MyServices:
http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.myservices(VS.80).aspx

Some of these things you would access thru the "My.XXX" syntax but others can be used directly.

So don't "avoid the namespace" but DO avoid using the legacy functions and use the newer .Net syntax equivalents.  This way your code will be more consistent with other .Net applications and make it easier to read.  Many of the legacy functions are still "one based" instead of "zero based" which can cause confusion and errors in code if you mix the legacy functions with newer .Net functions.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:SETP
ID: 18857654
Thanks guys
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18858930
glad to be of assistance.

AW
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18860574
:)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question