473,662 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2894
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*********@ya hoo.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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****@games4d otnet.com> wrote in message news:<uH******* *******@tk2msft ngp13.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*********@ya hoo.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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*********@ya hoo.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
yeah, i read that after i posted. anyone have a solid implementation
in C# that does this?

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

news:<uH******* *******@tk2msft ngp13.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*********@ya hoo.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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
4811
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 parent 1 2 1
4
13144
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 Nodes?
10
2011
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 appear as leaves in the Tree, rather than as new branches? Here's the code..
4
2303
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 by the user either scrolling or performing some other action that would move the treeview window to a particular "unloaded" node in the treeview Any advice on how to go about this? It seems I need a way of sensing a scroll event in the treeview...
6
2783
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: Me.tvGroups.Nodes.Add(GroupDataRow(0)("MenuGroupID").ToString, GroupDataRow(0)("GroupLabel")) to add a child to a Parent:
0
8785
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 image list to the Image List property of the Tree view control. Add this sample code to the form ============================= Private Sub Form_Load()
6
2506
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 ?? When adding a new node is there any way to get an handle or something else to be able add the childs to the correct parent ? Thanks!
1
1902
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, and adding a node was quite simple. Just specify the nodes key and position relative to the key where you want to add your new node. In VB2005 you can't do that anymore. I looking for a sample or help how this
2
1349
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 particular node of my treeview. ex :
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
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...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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,...
1
6185
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
4179
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...
1
2762
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
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.