Click here to Skip to main content
Click here to Skip to main content

A control class for browsing through the Network Neighborhood

, 3 Sep 2004 CPOL
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

Introduction

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.

Credits

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 NetworkSelect.zip 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)
    {
      networkSelect1.SeekThroughDomains(
        NetworkSelect.HIDE_CHECKBOXES,
        NetworkSelect.SHOW_SHARES,
        NetworkSelect.SHOW_HIDDENSHARES,
        NetworkSelect.SHOW_DIRECTORIES,
        NetworkSelect.SHOW_FILES);
    }
  • 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.

License

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

Share

About the Author

JurgenVanGorp

Belgium Belgium
Ever occupied IT consultant.

Comments and Discussions

 
Questioncreate a shared folder? Pinmembernimo115-Dec-05 0:16 
is there a way to create a share folder?
GeneralBug when getting the Full path PinmemberJosef Meile22-Mar-05 3:18 
GeneralRe: Bug when getting the Full path 2 PinmemberJosef Meile22-Mar-05 10:06 
GeneralCongratulations and a few improvements PinmemberJosef Meile11-Mar-05 9:19 
GeneralRe: Congratulations and a few improvements PinmemberJosef Meile11-Mar-05 9:30 
GeneralRe: Congratulations and a few improvements PinmemberJosef Meile11-Mar-05 11:29 
GeneralC++ version Pinmember1of34-Mar-05 7:02 
GeneralRe: C++ version PinmemberJurgenVanGorp4-Mar-05 8:06 
GeneralChecked Items Pinsussgirlatus25-Oct-04 12:54 
Generalnice work go on PinmemberTaha Zayed24-Sep-04 16:25 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 4 Sep 2004
Article Copyright 2004 by JurgenVanGorp
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid