Q
Problem solve Get help with specific problems with your technologies, process and projects.

What is the .NET equivalent to the WshNetwork object?

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?
.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.

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close