PC Review


Reply
Thread Tools Rate Thread

How do I know if a directory entry has no children object?

 
 
=?Utf-8?B?UHVjY2E=?=
Guest
Posts: n/a
 
      17th Jul 2006
I'm building a treeview and a list view. I need to know when I reached the
end of the tree nodes, which means that node or directory entry has no
children. Is there a property or method in DirectoryEntry class that does
this? If not, how can I verify this?
--
Thanks.
 
Reply With Quote
 
 
 
 
Tom Spink
Guest
Posts: n/a
 
      17th Jul 2006
Pucca wrote:

> I'm building a treeview and a list view. I need to know when I reached
> the end of the tree nodes, which means that node or directory entry has no
> children. Is there a property or method in DirectoryEntry class that does
> this? If not, how can I verify this?


Hi Pucca,

Are you asking about the TreeNode, if it doesn't have any children, or the
DirectoryEntry, if it doesn't have any children?

For the former, simply use the Count property of the Nodes property of the
TreeNode. If the latter, then there's no exposed method to return the
number of children in a DirectoryEntry. If you provide a bit more
information, we may be able to suggest alternatives.

For example, are you recursively building the TreeView?

--
Hope this helps,
Tom Spink

Google first, ask later.
 
Reply With Quote
 
=?Utf-8?B?UHVjY2E=?=
Guest
Posts: n/a
 
      17th Jul 2006
I have a treeview on the left panel and a Listview on the right panel.
Similar to one sees in the Active Driectory computer, users and groups
console.

If user clicks on a node on the left(treeview) then I would expand the node
if there are children and then I list these children nodes in the Listview on
the right.

I'm getting NullRefreneceException when I click on the Users or the Group
node which needs to list all the user and group objects on the listview and
this is where I'm getting the error when testing for the description either
value != null or descriptoin length >0.

if
(child.Properties["description"].Value.ToString() != null)
NodeDetail.Items.Add(new
ListViewItem(new string[] { split[1].ToString(),
child.Properties["description"].Value.ToString() }, 4));
else
NodeDetail.Items.Add("Name",
split[1].ToString(), 4);


--
Thanks.


"Tom Spink" wrote:

> Pucca wrote:
>
> > I'm building a treeview and a list view. I need to know when I reached
> > the end of the tree nodes, which means that node or directory entry has no
> > children. Is there a property or method in DirectoryEntry class that does
> > this? If not, how can I verify this?

>
> Hi Pucca,
>
> Are you asking about the TreeNode, if it doesn't have any children, or the
> DirectoryEntry, if it doesn't have any children?
>
> For the former, simply use the Count property of the Nodes property of the
> TreeNode. If the latter, then there's no exposed method to return the
> number of children in a DirectoryEntry. If you provide a bit more
> information, we may be able to suggest alternatives.
>
> For example, are you recursively building the TreeView?
>
> --
> Hope this helps,
> Tom Spink
>
> Google first, ask later.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
include children and children's birthdays in contact details =?Utf-8?B?SFBE?= Microsoft Outlook Contacts 2 17th Feb 2006 04:15 PM
MDI Forms - Children Calling Children of Parent combo cas Microsoft Dot NET Framework Forms 3 2nd May 2005 04:29 PM
MDI Forms - Children Calling Children of Parent Marcus Watts Microsoft Dot NET Compact Framework 3 2nd May 2005 12:21 PM
Active Directory Objects - Object reference not set to an instance of an object. Jason Dunbar Microsoft C# .NET 1 25th Jun 2004 07:55 PM
Class view/object browser for children of a class? News Microsoft C# .NET 1 19th May 2004 07:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:25 AM.