Active Directory Treeview Control

November 10, 2009 — 7 Comments

Here is a control I made that shows Active Directory objects. It inherits from the TreeView control and can be used to show AD objects for user selection in your program. You basically just pass it an LDAP path to the location in your Active Directory that you want it to use as the ‘root’ of the object tree and it does the rest.

See my post on vbforums for more information on how to use it and also for a download link: http://www.vbforums.com/showpost.php?p=3432250&postcount=1

7 responses to Active Directory Treeview Control

  1. 

    Thank you very much for creating this control. I read on your vbforums post that you have a sample project for ADTreeViewCtrl but I can’t seem to find it anywhere.

    Is this sample project available for download?

    I am rather short on sleep so I may have looked right at it but didn’t ‘see’ it.

    • 

      There used to be a sample project attached to the vbforums post but I took it off and replaced it with just the control because it didnt really serve any purpose. All you need to do is build the project that you download from the vbforums post (so that it creates the AdTreeViewCtrl DLL in the Release folder), then in a project where you want to use the control just right click on your toolbox and go to Choose Items, then browse to the AdTreeViewCtrl DLL. Now you should see the AdTreeView in the toolbox and you can just drag and drop it onto a form.

      • 

        I have made small working example but I am trying to view the contents of OUs in a ListBox rather than the TreeView.
        The problem I’ve run into is iterating through the objects within the selected OU.

        I will work on it a little more and post on the vbforums link listed above.

        Thanks again!

        • 

          Ah right well all you need to do is just get a DirectoryEntry instance for that OU (you can pass in the OU’s path to the constructor of the DirectoryEntry class) and then just loop through the items in the Children property of that DirectoryEntry. Post on vbforums if you get stuck and I’ll try help you out

  2. 

    I’m using your AD Info application (free version) from past 1 year and it works like a charm!

    I downloaded VB version of the control and it works fine. Do you have any plan to make the control using C# language?

    C# and PowerShell likes each other – not sure about VB! 🙂

    • 

      Powershell is built on .NET so it supports both C#.NET and VB.NET. Despite what most people think, VB.NET is just as good as C#.NET for 99% of scenarios (in fact personally I would argue it is slightly easier writing something in VB due to the plain English nature of the syntax, but maybe that’s just me). Making this AD tree view control in C# wouldn’t make any difference to how you could use it from Powershell, but if you really want to see it in C# then just run it through one of the many free online VB.NET to C#.NET converters

  3. 

    Hey Chris, love your DLL however i can’t find the new 1.5 version? Also you have a simple small working example? I got the old work without the DLL but i can’t seem to figure it out on the new controls…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s