There has to be an easier way to populate a Treeview

  • Thread starter Thread starter Tim Frawley
  • Start date Start date
T

Tim Frawley

I am working with some path strings that I pulled from Active
Directory. I want to populate a TreeView with these OUs and have been
beating my head agains the monitor trying to work it out.

Division1,Location1,Users
Division1,Location1,Workstations
Division1,Location2,Users
Division2,Location1,Users
Division2,Location1,Workstations
Division2,Location2,Users


Does anyone have any easier suggestions? What I am doing now is too
complicated and I keep getting multiple repetative values in the
TreeView.

Please help....

Tim Frawley
 
Hi

I think this depends on how do you organize your tree, which is concerted
about the algorithm which is not supported in the newsgroup.

e.g. as you have show, we can sort the date with three field(first is
Division, then Location). Then we can add the first level treenode of
division, then the location in the second level.

Division1,Location1,Users
Division1,Location1,Workstations
Division1,Location2,Users
Division2,Location1,Users
Division2,Location1,Workstations
Division2,Location2,Users

Also TreeView has a Addrange method will batchly add treenode.
this.treeView1.Nodes.AddRange(new TreeNode[]{new TreeNode("1"),new
TreeNode("2")});

Thanks for your understanding.



Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Tim,

The easiest way to see how you can populate a treeview is using the designer
to setup a whatever dump treeview.

Than look in the code part of the designer.
It is very efficient done by the designer so giving you a sample would be
weird.

I hope this helps

Cor
 
Peter and Cor,

Thanks for the response guys. I did check out the Range method for the
TreeView control.

I managed to figure out a method that does the job and it works great
now.

Thanks!

Sincerely,

Tim Frawley
 
Hi

I am glad that you have found the solution.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top