473,808 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

treeview AD code inside - need help

I have two examples of populating a treeview with AD
information below.
example A does exactly what I want, starts at the AD tree,
but is really slow to generate.
examble B gives more information, but is really fast.
example B displays all the providers (ie. WinNT, NWcompat,
NDS, IIS, and LDAP) I just want it to start at the top
level of my AD tree. (LDAP only)

This way the end user (help desk) can drill down the tree
to get to the user or OU that they are modifying.
-------------
examples below
-------------
example A
-------------
Private Sub Form_Initialize ()
Dim strBase As String
Dim strUserBase As String
Dim oRoot As Object
Dim oOu As Object
Dim rootnode As Node

Set oRoot = GetObject("LDAP ://RootDse")
strBase = oRoot.Get("defa ultNamingContex t")
strUserBase = Replace(strBase , "DC=", "")
strUserBase = Replace(strUser Base, ",", ".")
TreeView1.Image List = ImageList1
Set oOu = GetObject("LDAP ://" & strBase)
Set rootnode = TreeView1.Nodes .Add(, , strBase,
strUserBase, 3)
rootnode.Select ed = False
Call AddOUs(oOu, rootnode)

End Sub

Sub AddOUs(oOu As Object, Node As Node)
Dim nd As Node
Dim ou As Object
Dim oNextOU As Object

oOu.Filter = Array("organiza tionalunit")

For Each ou In oOu
Set nd = TreeView1.Nodes .Add(Node, tvwChild,
ou.ADsPath, Replace(ou.Name , "OU=", ""), 1)
Set oNextOU = GetObject(ou.AD sPath)
Call AddOUs(oNextOU, nd)
Next

End Sub
-------------
example A
-------------

Option Explicit
Private Sub Form_Load()
Dim myADS As IADs
Dim Member As IADs
Dim DirectoryObject As IADs

On Error Resume Next
Set myADS = GetObject("ads: ")

For Each Member In myADS
Me.TreeView1.No des.Add , , Member.ADsPath, Member.Name
+ "(" + Member.ADsPath + ")"
Me.TreeView1.No des.Add Member.ADsPath, tvwChild,
Member.ADsPath + ";Dummy", "Dummy Node"
Next

End Sub

Private Sub TreeView1_Expan d(ByVal Node As
MSComctlLib.Nod e)
Dim adsParent As IADsContainer
Dim adsChild As IADs

On Error GoTo Error_Handler:

'Check to see whether this node has been previously
expanded...
If Node.Children = 1 Then
'There is only one child node. Is it a dummy node?
If Node.Child.Key = Node.Key + ";Dummy" Then
'Yes.
'Delete it
Me.TreeView1.No des.Remove Node.Child.Key
'Create real children...
Set adsParent = GetObject(Node. Key)
For Each adsChild In adsParent
Me.TreeView1.No des.Add Node.Key, tvwChild,
adsChild.ADsPat h, adsChild.Name + " (" + adsChild.ADsPat h
+ ")"
Me.TreeView1.No des.Add adsChild.ADsPat h,
tvwChild, adsChild.ADsPat h + ";Dummy", "Dummy Node"
Next
End If
End If

Error_Handler:
End Sub
Please help modify the fast one to only display the AD
(ldap) provider.
Thanks,
Mark
Jul 17 '05 #1
0 4353

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4583
by: Trond Hoiberg | last post by:
Let say i have a bunch of files. Logfiles that is stored in subfolders. Folder1 --logfile1 --logfile2 --logfile3 Folder2 --logfile1 --logfile2 I want to display these files using data from the files in an TreeView
7
11110
by: Mike | last post by:
hi everyone! i'm searching for a tutorial or an example for how to fill a treeview with information from my ms sql database. i've found some on "code project" and other sites, but nothing like a real tutorial for beginners. does anyone knows some helpflul links or can give me a short intro? my treeview should act like a navigator or explorer-like, so that a click on a node shows some detailed information on the right side of my win app....
4
14182
by: Ben Coats | last post by:
Hey, I'm trying to find code for an Explorer-style Directory ComboBox. (You know, it display "Desktop", "My Computer", all drives, etc., but it has a treeview control inside the combobox so that you can navigate through the file system as well.) I've found some on the web, but all of them just have the drives and desktop directories and are static in that you cannot expand the directories. I normally build a treeview control to do it with,...
1
1191
by: iqbal | last post by:
Hi, I am writting an application in outlook style which has Left Panel and a Right Panel. I have Treeview COntrol in left panel, and I load the forms in right panel on AfterSelect event of the treeview. I am coming across 2 problems: 1) Forms event "Activated" does not trigger. Even when I force the event using f1.Activate, it does not execute the code inside the event.
8
12787
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if every time that a user selects a node, the whole page has to reload. Is there a way to have a node...
1
6181
by: Dmitry Perets | last post by:
Hello, There is a known problem with TreeView checkboxes in ASP.NET: they can't do AutoPostBack. So I've solved this problem like this: <script language="javascript" type="text/javascript"> function postbackOnCheck() { var o = window.event.srcElement;
0
819
by: Mailing List SVR | last post by:
Hi, I have a database with the following structure: id name sublevel for example 1 Node1 None 2 Node2 1
0
731
by: Mailing List SVR | last post by:
Il giorno ven, 23/05/2008 alle 09.20 +0200, Mailing List SVR ha scritto: only for the records attacched is a working solution, maybe not the best one but a working one, regards Nicol
3
10096
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, "And the link to Microsoft's site on that blog says: "The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control: TreeView and Menu controls. ....
5
7525
by: Max2006 | last post by:
Hi, I have a TreeView and this is my node style: <asp:TreeNodeStyle ForeColor = "#000000" Font-Size="9px" Font-Bold="false" Width="100px" NodeSpacing="3px" /> The problem is the expand button (+) resides right at the middle of multi-line text. Can I make the expand button top align instead of middle align?
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10375
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.