Object browser(F2) how to pick best object to use

CDBob2000

Member
Joined
May 23, 2006
Messages
8
Programming Experience
1-3
Hi! All

I would like to know which is a better object to pick from the Object Browser...
(The object browser that I'm referring to is the one you get when you hit F2)

It just hit me that there are many ways to skin the cat,,

For example I found two Object for file copy (could be more Don't know)

this syntax Copy(loc1, loc2, True)
goes with

Imports System.IO.File
AND
this one
CopyFile(loc1, loc2, True)
goes with
Imports Microsoft.VisualBasic.FileIO.FileSystem



Just to add
--------------------------------------------------------------------------

I hope I got the right thread and forum cause I am confused at the what the correct definition are for the abbreviations.
There are thread for here for VS.net.and VB.net and I don't see a general thread for the head dog Microsoft Visual Studio 2005 Pro

(I am using Microsoft Visual Studio 2005 Pro and I'm playing with Microsoft Visual Basic 2005 that is included in the package)

I am assuming Microsoft Visual Studio 2005 is at the head of the table and VS.net. and VB.net are guest at the table cause of these sentences

"Visual Studio is a suite of applications created by Microsoft to give developers a compelling development environment for the Windows and .NET platforms. Visual Studio can be used to write console applications, Windows applications, Windows services, Windows Mobile applications, ASP.NET applications, and ASP.NET web services, in your choice of C++, C#, VB.NET, J#, and more. Visual Studio also includes various additional development tools, such as Visual SourceSafe; which tools are included depends greatly on the edition of Visual Studio that you are using."

Refenced from >>> .http://www.windowsdevcenter.com/pub/a/windows/2005/08/22/whatisVisualStudio.html

"Visual Studio .NET (VS.NET) is Microsoft's next generation of development tools."

"VS.NET supports a number of different programming languages ranging from C++ to COBOL. The core languages of VS.NET include VB.NET, C# and C++"

Refenced from >>> .http://www.netdesk.com/articles_developer/vsnet.asp



Object browser(F2) how to pick best one to use
 
You don't use the Microsoft.VisualBasic.FileIO.FileSystem class directly. It is intended to be used through the My.Computer.FileSystem object. The FileSystem class basically wraps the FileSystemObject from the Windows Scripting Host. It works differently to the IO.File class and some of the methods can do things that the IO.File class can't, like display a progress dialogue while perfroming an operation. Which you use is up to you but I suggest that you work out a system and stick to it because consistency is a good thing. My system is that I avoid the My namespace unless I specifically want the functionality that it provides and can't get that functionality simply elsewhere. In your situation that means that I would use IO.File.Copy. Others may choose to use the My namespace wherever possible, in which case they would use My.Computer.FileSystem.CopyFile in your situation. Neither is any more correct than the other, but one reason I choose not to rely on the My namespace too much is that it doesn't exist in C# and I do code in C# almost as much as VB. Having said that, it is possible to import the My namespace into a C# project.

Here are a couple of other points. Although you can, I strongly suggest that you do not import class names in a file. It is better practice in my opinion, and much more commonplace, to import namespaces and then qualify members with the class name. That means that instead of this:
VB.NET:
Imports System.IO.File

Copy(loc1, loc2, True)
you would do this:
VB.NET:
Imports System.IO

File.Copy(loc1, loc2, True)
You are much more likely to encounter name clashes and cause confusion if you import class names.

As to the different forums, VS.NET is Visual Studio. That group of forums are for questions relating to the Visual Studio IDE. The VB.NET forums are for question relating to the Visual Basic .NET language. In the 2005 revisions Microsoft has dropped the ".NET" label from all its products but it is still the same thing. There is no differentiation between 2005 and earlier versions in the forum layout, which is why the Primary Platform field has been added to the user profile. Because you have set yours to 2005 we know that you're using that version and can advise accordingly. If only everyone else was as conscientious.
 
Ok thanks!

I see I will need to find more info on a Namespaces before I make a pick....

Does it do it how I want it done..
Which remote does the job,,, the one with no light works just fine...

You also kind of cleared up a question I had in the back of head by saying to drop the .File off the end... and use system.io then file.copy(
to prevent conflicts...

LOL I ended up with the file on the end cause I uncheck all the stuff in the imported namespace reference window just to see what happen..
OH boy! Then I looked up the stuff that threw an error using the object browser window... that is when I saw there where many options,,,

I see why the Copy turned into File.Copy( now Don't drill to deep cause you will hit the lava core........

I'll stick with using System.IO in the properties tab reference in the imported namespace listbox the use file.copy in the code...

this way I will NOT have to add the imports system.IO on the code pages

Cool I think I got a little smarter here.....


LOl if only I could get folks to put real working examples on the internet,,,,
They all seem to copy and paste the stuff that doesn't work in the first place... You know it is a copy and paste job cause they all keep the same remarks ,, coded by........
 
Back
Top