tags:

views:

157

answers:

1

I have Client-Server environment and developed a project for Client-Server.

I need to share a folder of my Server machine programmatically using VB.NET

Please help me.

+3  A: 

Here's one example which shows the concept using ManagmentClass. It's C# but easily convertible to VB.NET:


UPDATE:

Directory.CreateDirectory("C:\MyTestShare")
Dim managementClass As New ManagementClass("Win32_Share")
Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
inParams.Item("Description") = "My Files Share"
inParams.Item("Name") = "My Files Share"
inParams.Item("Path") = "C:\MyTestShare"
inParams.Item("Type") = 0
If (DirectCast(managementClass.InvokeMethod("Create", inParams, Nothing).Properties.Item("ReturnValue").Value, UInt32) <> 0) Then
    Throw New Exception("Unable to share directory.")
End If
Darin Dimitrov
Would you please please please convert the code in VB.NET for me?
Tareq
Please see my update.
Darin Dimitrov
Thanks a lot for helping me.
Tareq
You're welcome.
Darin Dimitrov
Wow. Is there anything for which .NET doesn't have a class?
aape