Click here to Skip to main content
13,398,905 members (36,225 online)
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 15 Apr 2004

Sharing resources in the local network with VB 6.0

, 30 Aug 2007
Rate this:
Please Sign up or sign in to vote.
How to share folders in a network with VB 6.0
  • <a href="VBNetworkResources/">Download source file - 3 Kb</a> 


In my local network, it is common an equipment to be turned off and others have mapped folders of it. Windows shows a warning window. It informs that the resource is not available in the moment and that the operator can choose for not more to use the unavailable resource.

Each user when doing logon, it's executed for he a script. This script makes all it adjusts them and necessary updatings in the system. I then opted to not to show any window type and simply to ignore the mistake screens.

My reality

There is a service that resides in all the equipments. It verifies periodically for updating files. When an user makes logon, the others are informed of the event (like MSN Messeger). The personal computer seeks for events associated the user and it executes.

Common events

The most common events are:
- to map a resource,
- to post a file,
- warnings,


I use applications VB to work the system. Then, I developed a small class to map the resources.


My reports are printed like PDF and published in the browser. Then:

Sub MapReportFolder()  
Dim Net As New clsNetworkClient  
Dim Ret As Long  
    Ret = Net.Connect("R:", "\\<a href="file://ESRVD048829A03/REPORT">ESRVD048829A03\REPORT</a>", Net.ComputerName, "")  

<pre lang=""> 
    If Not Ret = 0 Then  
       Call LogEvent (date, time, WnetError(Ret))  
    End If  

End Sub  

Error Trap

The return code can be tested and show a mensage to user:

Private Const ERROR_SUCCESS As Integer = 0
Private Const WN_Success As Long = &H0
Private Const WN_Not_Supported As Long = &H1
Private Const WN_Net_Error As Long = &H2
Private Const WN_Bad_Pointer As Long = &H4
Private Const WN_Bad_NetName As Long = &H32
Private Const WN_Bad_Password As Long = &H6
Private Const WN_Bad_Localname As Long = &H33
Private Const WN_Access_Denied As Long = &H7
Private Const WN_Out_Of_Memory As Long = &HB
Private Const WN_Already_Connected As Long = &H34
Private Function WnetError(ByVal Errcode As Long) As String
    Select Case Errcode
        Case WN_Not_Supported
        WnetError = "Function is Not supported."
      Case WN_Out_Of_Memory
        WnetError = "Out of Memory."
      Case WN_Net_Error
        WnetError = "An error occurred On the network."
      Case WN_Bad_Pointer
        WnetError = "The Pointer was Invalid."
      Case WN_Bad_NetName
        WnetError = "Invalid Network Resource Name."
      Case WN_Bad_Password
        WnetError = "The Password was Invalid."
      Case WN_Bad_Localname
        WnetError = "The local device name was invalid."
      Case WN_Access_Denied
        WnetError = "A security violation occurred."
      Case WN_Already_Connected
        WnetError = "The local device was connected To a remote resource."
      Case Else
        WnetError = "Unrecognized Error " + Str(Errcode) + "."
    End Select
End Function


My sincere gratefulness to the friend Wilsimar Araújo, a fantastic Designer.


Phone: +55 (61) 9162-8541


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer
Brazil Brazil
- MS VB6
- C/C++/C#
- VBScript
- JScript
- Clipper
- Cobol
- Natural
- Pascal
- TCL/Tk
- Python
Willian Silva Rodrigues
--- --- --- ---
BBM PIN: 238d4349

You may also be interested in...


Comments and Discussions

GeneralError Messages Pin
frankzappa29-Aug-07 19:19
memberfrankzappa29-Aug-07 19:19 
GeneralRe: Error Messages Pin
Willian.BR30-Aug-07 7:03
memberWillian.BR30-Aug-07 7:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180218.2 | Last Updated 30 Aug 2007
Article Copyright 2004 by WillianBR
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid