Click here to Skip to main content
13,349,033 members (70,376 online)
Click here to Skip to main content
Add your own
alternative version


52 bookmarked
Posted 3 Sep 2004

A control class for browsing through the Network Neighborhood

, 3 Sep 2004
Rate this:
Please Sign up or sign in to vote.
If you want to have an easy-to-use Dialog Box to browse through the network, have a look at this. This library allows for selecting network shares, directories, files, ... and will ask for a user name and password, if needed.

Sample Image - ScreenShot1.jpg


NetworkSelect is a control library that allows you to browse through the Network Neighborhood. It is possible to select the level of download, from domains, down to shares, directories, and files. The control will ask for a user name and password if a computer cannot be accessed.


This control is based on the excellent work of Richard Deeming (CodeProject member ID:34187) and Marc Merritt (member ID: 2851). They both provided some means to access network shares, and I've included (parts of) their classes in this project. Despite their good work, I still did not have some user-friendly way to browse through the Network Neighborhood, and that's how this control got created.

Using the code

The control code spreads a larger number of pages, so allow me not to go too deep into the details of the class itself.

In its simplest form, the control is used pretty straightforward.

  • Step 1 Expand the file.
  • Step 2 Create a new C# project in the same folder.
  • Step 3 During development, you'd probably like to copy the images folder to your bin\Debug and bin\Release folders. The application expects that this images folder be present in the current application directory.
  • Step 4 When opening the new project, add the following "Existing files" to your project:
    • AskPassword.cs
    • CompEnum.cs
    • NetworkSelect.cs
    • Shares.cs

    Then perform a "Build Solution" to add the control to your project.

  • Step 5 Draw the NetworkSelect control in the Form1. Add a Button, button1, to the form.
  • Step 6 Add the following using clause in the header of your program:
    using TIData.NetworkSelect;
  • Step 6 Add the following button1_Click method to your program:
    private void button1_Click(object sender, System.EventArgs e)
  • Step 7 The domains, computers, shares, ..., files can be extracted using the following methods:

    string myDomain = networkSelect1.GetCurrentDomain();
    string myComputer = networkSelect1.GetCurrentComputer();
    string myShare = networkSelect1.GetCurrentShare();
    string myDir = networkSelect1.GetCurrentDirectory();
    string myFile = networkSelect1.GetCurrentFile();
    string fullPath = networkSelect1.GetFullName();

Finally, all the rest is for you...

A few notes

Regrettably, browsing through the Network can be a time consuming task. This is certainly the case whenever you don't have full rights to all domain computers. Therefore, the control shows a "Working hard for you, please wait..." message when enumerating domains, servers, ... files.

Although you can enable check boxes, I haven't included a method to read the checked paths. Hey, this is the very first release: 0.90. Shouldn't take too much time. Leave me a note if you badly need it.

I already know that the control shows up with a few Warnings too much. Will be fixed in the next release. The good thing is that it also shows a pop-up asking for a username/password whenever you don't manage to view the shares of a computer.

Version History

Not much of a history. This is the first release. Let's call it V0.9.0.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Belgium Belgium
Ever occupied IT consultant.

You may also be interested in...


Comments and Discussions

GeneralC++ version Pin
1of34-Mar-05 7:02
member1of34-Mar-05 7:02 
GeneralRe: C++ version Pin
JurgenVanGorp4-Mar-05 8:06
memberJurgenVanGorp4-Mar-05 8:06 

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
Web02 | 2.8.180111.1 | Last Updated 4 Sep 2004
Article Copyright 2004 by JurgenVanGorp
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid