Home > Ask the Microsoft .Net Development Experts > C# Development Questions & Answers > What is the .NET equivalent to the WshNetwork object?
Ask The Win Development Expert: Questions & Answers
EMAIL THIS

What is the .NET equivalent to the WshNetwork object?

Daniel Cazzulino EXPERT RESPONSE FROM: Daniel Cazzulino

Pose a Question
Other Win Development Categories
Meet all Win Development Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 12 February 2004
I'm trying to port an old VB application to C#, but I cannot find any methods in C# that do the same as the following two methods.

Dim wshNetwork As New IWshNetwork_Class
wshNetwork.RemoveNetworkDrive
wshNetwork.MapNetworkDrive

Do you know the .NET equivalent to the WshNetwork object?


>
EXPERT RESPONSE
.NET provides native support for COM components. You can add a reference to the DLL you're using actually and use it directly from your C# code. Therefore, once you have the library referenced, you could use:

IWshNetwork_Class wshNetwork = new IWshNetwork_Class();
wshNetwork.RemoveNetworkDrive();
wshNetwork.MapNetworkDrive();

I have never used this library, so I'm not sure if the parameters are correct or the type to be created is the right one, but you get the idea.

Additional options and info on how to achieve this were discussed in the csharp newsgroup. Read the comments here: http://www.dotnet247.com/247reference/msgs/11/56914.aspx.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
C# programming language
LINQ beyond queries: Strong-typed refection
Assembly versioning in the .NET Framework 2.0
Book excerpt: Creating graphical output using the .NET Compact Framework
Visual Studio 2008 Learning Guide: C# 3.0
Simonyi firm to address divide between domain experts and developers
On Extension Methods in C# and .NET Framework 3.5
Generate RSA public and private keys, export to XML
Book excerpt: Upgrading to Visual Studio 2005
Learning .NET: Tips for getting started with .NET development
Book excerpt: Code snippets in Visual Studio 2005

C#
Top C# expert advice
Escape from mailto:
Can I run a .NET app without installing .NET runtime?
Opening a link with parameters to a new window
Is it possible to open a child form in modal type?
Painting in the non-client area
Global cases to the entire application
Validating the textbox entry for date format
Book on network programming with C#
Calling a secondary UserControl applet

C# Development
Top C# expert advice
Using LoadRunner for testing in .NET
Take care with InitializeComponent
GroupBox inheritance
Escape from mailto:
Windows Forms: Overriding the OnClosing method
Passing data between forms
Can I run a .NET app without installing .NET runtime?
Opening a link with parameters to a new window
Is it possible to open a child form in modal type?

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
C#  (SearchWinDevelopment.com)
GLib  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts