473,396 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding Nodes to a TreeView

Question here:

I have been trying to find a way to add existing nested nodes to a
tree that already has nodes in it:

So, my tree looks like this:

-com
-foo
-goo
-blue
-true

then, i have a node that contains the following children:

-com
-foo
-goo
-blue
-NEW

i try adding this to the treeview's root and then i get two com trees
right next to each other. what algorithm do i need to insert this new
node properly so that the resulting treeview looks like:
-com
-foo
-goo
-blue
-true
-NEW
? Thanks in advance
Nov 15 '05 #1
3 2883
You need a basic recursion algorithm that does updates of existing nodes and
inserts for nodes that don't already exist. This is called a merge, and
unfortunately
the TreeView doesn't already support a method for it.
--
Justin Rogers
DigiTec Web Consultants, LLC.

"sho_nuff" <sh*********@yahoo.com> wrote in message
news:49**************************@posting.google.c om...
Question here:

I have been trying to find a way to add existing nested nodes to a
tree that already has nodes in it:

So, my tree looks like this:

-com
-foo
-goo
-blue
-true

then, i have a node that contains the following children:

-com
-foo
-goo
-blue
-NEW

i try adding this to the treeview's root and then i get two com trees
right next to each other. what algorithm do i need to insert this new
node properly so that the resulting treeview looks like:
-com
-foo
-goo
-blue
-true
-NEW
? Thanks in advance

Nov 15 '05 #2
yeah, i read that after i posted. anyone have a solid implementation
in C# that does this?

"Justin Rogers" <Ju****@games4dotnet.com> wrote in message news:<uH**************@tk2msftngp13.phx.gbl>...
You need a basic recursion algorithm that does updates of existing nodes and
inserts for nodes that don't already exist. This is called a merge, and
unfortunately
the TreeView doesn't already support a method for it.
--
Justin Rogers
DigiTec Web Consultants, LLC.

"sho_nuff" <sh*********@yahoo.com> wrote in message
news:49**************************@posting.google.c om...
Question here:

I have been trying to find a way to add existing nested nodes to a
tree that already has nodes in it:

So, my tree looks like this:

-com
-foo
-goo
-blue
-true

then, i have a node that contains the following children:

-com
-foo
-goo
-blue
-NEW

i try adding this to the treeview's root and then i get two com trees
right next to each other. what algorithm do i need to insert this new
node properly so that the resulting treeview looks like:
-com
-foo
-goo
-blue
-true
-NEW
? Thanks in advance

Nov 15 '05 #3
Just added a brief sample at:

http://www.windowsforms.net/Forums/S...1&PostID=11233

--
Justin Rogers
DigiTec Web Consultants, LLC.

"sho_nuff" <sh*********@yahoo.com> wrote in message
news:49**************************@posting.google.c om...
yeah, i read that after i posted. anyone have a solid implementation
in C# that does this?

"Justin Rogers" <Ju****@games4dotnet.com> wrote in message

news:<uH**************@tk2msftngp13.phx.gbl>...
You need a basic recursion algorithm that does updates of existing nodes and
inserts for nodes that don't already exist. This is called a merge, and
unfortunately
the TreeView doesn't already support a method for it.
--
Justin Rogers
DigiTec Web Consultants, LLC.

"sho_nuff" <sh*********@yahoo.com> wrote in message
news:49**************************@posting.google.c om...
Question here:

I have been trying to find a way to add existing nested nodes to a
tree that already has nodes in it:

So, my tree looks like this:

-com
-foo
-goo
-blue
-true

then, i have a node that contains the following children:

-com
-foo
-goo
-blue
-NEW

i try adding this to the treeview's root and then i get two com trees
right next to each other. what algorithm do i need to insert this new
node properly so that the resulting treeview looks like:
-com
-foo
-goo
-blue
-true
-NEW
? Thanks in advance

Nov 15 '05 #4

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

Similar topics

4
by: ghanley | last post by:
Hi Guys, I need some help with a problem related to the looping through a recordset to display on a tree view control. My table has no Primary key - because duplicates are allowed. ID ...
4
by: Chuck Bowling | last post by:
I have a serialized TreeNodeCollection that I want to initialize a TreeView with. Is there a simple assignment I can use for this or do I have to iterate thru the collection and add individual...
10
by: Dan Nash | last post by:
Hi peeps.. Im using the TreeView control from IE COntrols to create a directory structure, and trying to do it recursively. The code works, but my question is simply how can I make the subdirs...
4
by: pmcguire | last post by:
I have a treeview with a lot of nodes. I want to load only the nodes that are initially visible when the form loads, and then continue to populate it in background and/or when the nodes are required...
6
by: =?Utf-8?B?QnJhZA==?= | last post by:
VS,VB 2005 I have a treeview which i load data into in the forms load event Adding Nodes and Children to the parent nodes works fine to add a parent:...
0
debasisdas
by: debasisdas | last post by:
Select Microsoft windows common controls 6.0 (SP6) from components Add a TreeView control to the form. Add a ImageList control to the form. Add some bitmaps to the imagelist. Set the name of...
6
by: SQACSharp | last post by:
I'm using the EnumChildWindows API with an EnumChildWndProc callback to populate the treeview. The output will be something similar to spy+ + How can I specify the parent when adding a new node...
1
by: Bart Steur | last post by:
Hi As a VB6 user I'm unfamiliar with the Treeview control of VB2005. I read it was changed but I have a hard time finding the right help/samples for my problem. In VB6 you had 1 collection,...
2
by: michelqa | last post by:
Hi, I'm trying to add nodes to a specific node of a treeview. With VS 2005 and more (>= .net 2.0) I can set the Nodes.Name property and then use Nodes.Find("MyNodeName",true) to add nodes to a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.