I need to put a new node at the end of the tree, that end is not te lowest
in de list but the deepest
(the one with the most + before it)
Node A
Node 1
Node 2
Node 3
Node 4: Deepest
Node B: not this one
I need to Put everytime a new child to the Deepest so:
first:
Node A
then
Node A
Node 1
then
Node A
Node 1
Node 2
and so on
I tried many things, like TreeNodeCollect ion and
treeViewSequenc e.Nodes.GetEnum erator() But i can't find a way to fix this,
it is difficult to get the child, help me....
Thx
JC 5 3306
As I told before, there's no pre-defined method/property for your problem.
You need to come up with an algorithm.... Do you think something like this
will solve your problem?
TreeNode deepest;
int deepestLevel = 0;
foreach (TreeNode node in treeView.Nodes)
{
// This will get all the top level nodes - and now, let's iterate
// through each one.
int level = 0;
while (node.Nodes.Cou nt > 0)
{
level++;
node = node.Nodes[0];
}
// Check if we hit the deepest
if (level >= deepestLevel)
deepestNode = node;
}
// Now, add your new node to the deepest node
deepestNode.Nod es.Add(newNode) ;
-vJ
"Jeroen Ceuppens" <je************ *@barco.com> wrote in message
news:eg******** ******@TK2MSFTN GP10.phx.gbl... I need to put a new node at the end of the tree, that end is not te lowest in de list but the deepest (the one with the most + before it)
Node A Node 1 Node 2 Node 3 Node 4: Deepest Node B: not this one
I need to Put everytime a new child to the Deepest so:
first: Node A
then
Node A Node 1
then
Node A Node 1 Node 2
and so on
I tried many things, like TreeNodeCollect ion and treeViewSequenc e.Nodes.GetEnum erator() But i can't find a way to fix this, it is difficult to get the child, help me....
Thx JC
Sorry - small correction... Check below
"Vijaye Raji" <no************ @hotmail.com> wrote in message
news:9a******** ************@co mcast.com... As I told before, there's no pre-defined method/property for your problem. You need to come up with an algorithm.... Do you think something like
this will solve your problem?
TreeNode deepest; int deepestLevel = 0; foreach (TreeNode node in treeView.Nodes) { // This will get all the top level nodes - and now, let's iterate // through each one. int level = 0; while (node.Nodes.Cou nt > 0) { level++; node = node.Nodes[0]; }
// Check if we hit the deepest if (level >= deepestLevel)
{ deepestNode = node;
// CORRECTION: This line is important.
deepestLevel = level
} }
// Now, add your new node to the deepest node deepestNode.Nod es.Add(newNode) ;
-vJ
"Jeroen Ceuppens" <je************ *@barco.com> wrote in message news:eg******** ******@TK2MSFTN GP10.phx.gbl... I need to put a new node at the end of the tree, that end is not te
lowest in de list but the deepest (the one with the most + before it)
Node A Node 1 Node 2 Node 3 Node 4: Deepest Node B: not this one
I need to Put everytime a new child to the Deepest so:
first: Node A
then
Node A Node 1
then
Node A Node 1 Node 2
and so on
I tried many things, like TreeNodeCollect ion and treeViewSequenc e.Nodes.GetEnum erator() But i can't find a way to fix
this, it is difficult to get the child, help me....
Thx JC
Thx!
There is still a problem:
C:\Documents and Settings\Eindwe rk\Mijn documenten\BARC O\Eindwerk\Proj ect
Files\thuis\29n ovember\TestTre e\Form1.cs(206) : Property or indexer
'System.Windows .Forms.TreeNode .Parent' cannot be assigned to -- it is read
only
this error i get on node = node.Nodes[0];
Do you know what i can do to make it not read only?
Thx
JC
"Vijaye Raji" <no************ @hotmail.com> schreef in bericht
news:-Y************** ******@comcast. com... Sorry - small correction... Check below
"Vijaye Raji" <no************ @hotmail.com> wrote in message news:9a******** ************@co mcast.com... As I told before, there's no pre-defined method/property for your
problem. You need to come up with an algorithm.... Do you think something like this will solve your problem?
TreeNode deepest; int deepestLevel = 0; foreach (TreeNode node in treeView.Nodes) { // This will get all the top level nodes - and now, let's iterate // through each one. int level = 0; while (node.Nodes.Cou nt > 0) { level++; node = node.Nodes[0]; }
// Check if we hit the deepest if (level >= deepestLevel) { deepestNode = node;
// CORRECTION: This line is important. deepestLevel = level } }
// Now, add your new node to the deepest node deepestNode.Nod es.Add(newNode) ;
-vJ
"Jeroen Ceuppens" <je************ *@barco.com> wrote in message news:eg******** ******@TK2MSFTN GP10.phx.gbl... I need to put a new node at the end of the tree, that end is not te
lowest in de list but the deepest (the one with the most + before it)
Node A Node 1 Node 2 Node 3 Node 4: Deepest Node B: not this one
I need to Put everytime a new child to the Deepest so:
first: Node A
then
Node A Node 1
then
Node A Node 1 Node 2
and so on
I tried many things, like TreeNodeCollect ion and treeViewSequenc e.Nodes.GetEnum erator() But i can't find a way to fix this, it is difficult to get the child, help me....
Thx JC
Ok.. My mistake... objects from foreach are read-only.
Here's a modified version:
TreeNode deepestNode = null;
int deepestLevel = 0;
foreach (TreeNode node in treeView1.Nodes )
{
// This will get all the top level nodes - and now, let's
iterate
// through each one.
int level = 0;
TreeNode nodeTemp = node;
while (nodeTemp.Nodes .Count > 0)
{
level++;
nodeTemp = nodeTemp.Nodes[0];
}
// Check if we hit the deepest
if (level >= deepestLevel)
{
deepestNode = nodeTemp;
deepestLevel = level;
}
}
// Now add your new node
deepestNode.Nod es.Add(newNode) ;
-vJ
"Jeroen Ceuppens" <je************ *@barco.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Thx!
There is still a problem:
C:\Documents and Settings\Eindwe rk\Mijn documenten\BARC O\Eindwerk\Proj ect Files\thuis\29n ovember\TestTre e\Form1.cs(206) : Property or indexer 'System.Windows .Forms.TreeNode .Parent' cannot be assigned to -- it is read only
this error i get on node = node.Nodes[0]; Do you know what i can do to make it not read only?
Thx JC
"Vijaye Raji" <no************ @hotmail.com> schreef in bericht news:-Y************** ******@comcast. com... Sorry - small correction... Check below
"Vijaye Raji" <no************ @hotmail.com> wrote in message news:9a******** ************@co mcast.com... As I told before, there's no pre-defined method/property for your problem. You need to come up with an algorithm.... Do you think something like this will solve your problem?
TreeNode deepest; int deepestLevel = 0; foreach (TreeNode node in treeView.Nodes) { // This will get all the top level nodes - and now, let's iterate // through each one. int level = 0; while (node.Nodes.Cou nt > 0) { level++; node = node.Nodes[0]; }
// Check if we hit the deepest if (level >= deepestLevel) { deepestNode = node;
// CORRECTION: This line is important. deepestLevel = level } }
// Now, add your new node to the deepest node deepestNode.Nod es.Add(newNode) ;
-vJ
"Jeroen Ceuppens" <je************ *@barco.com> wrote in message news:eg******** ******@TK2MSFTN GP10.phx.gbl... > > I need to put a new node at the end of the tree, that end is not te lowest > in de list but the deepest > (the one with the most + before it) > > Node A > Node 1 > Node 2 > Node 3 > Node 4: Deepest > Node B: not this one > > I need to Put everytime a new child to the Deepest so: > > first: > Node A > > then > > Node A > Node 1 > > then > > Node A > Node 1 > Node 2 > > and so on > > I tried many things, like TreeNodeCollect ion and > treeViewSequenc e.Nodes.GetEnum erator() But i can't find a way to fix this, > it is difficult to get the child, help me.... > > Thx > JC > > >
YEAH! it works!
Thx a lot dude!
Greetz
JC
"Vijaye Raji" <no************ @hotmail.com> schreef in bericht
news:e5******** ******@TK2MSFTN GP10.phx.gbl... Ok.. My mistake... objects from foreach are read-only.
Here's a modified version:
TreeNode deepestNode = null; int deepestLevel = 0; foreach (TreeNode node in treeView1.Nodes ) { // This will get all the top level nodes - and now, let's iterate // through each one. int level = 0; TreeNode nodeTemp = node; while (nodeTemp.Nodes .Count > 0) { level++; nodeTemp = nodeTemp.Nodes[0]; }
// Check if we hit the deepest if (level >= deepestLevel) { deepestNode = nodeTemp; deepestLevel = level; } } // Now add your new node deepestNode.Nod es.Add(newNode) ;
-vJ
"Jeroen Ceuppens" <je************ *@barco.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Thx!
There is still a problem:
C:\Documents and Settings\Eindwe rk\Mijn
documenten\BARC O\Eindwerk\Proj ect Files\thuis\29n ovember\TestTre e\Form1.cs(206) : Property or indexer 'System.Windows .Forms.TreeNode .Parent' cannot be assigned to -- it is
read only
this error i get on node = node.Nodes[0]; Do you know what i can do to make it not read only?
Thx JC
"Vijaye Raji" <no************ @hotmail.com> schreef in bericht news:-Y************** ******@comcast. com... Sorry - small correction... Check below
"Vijaye Raji" <no************ @hotmail.com> wrote in message news:9a******** ************@co mcast.com... > As I told before, there's no pre-defined method/property for your problem. > You need to come up with an algorithm.... Do you think something
like this > will solve your problem? > > TreeNode deepest; > int deepestLevel = 0; > foreach (TreeNode node in treeView.Nodes) > { > // This will get all the top level nodes - and now, let's
iterate > // through each one. > int level = 0; > while (node.Nodes.Cou nt > 0) > { > level++; > node = node.Nodes[0]; > } > > // Check if we hit the deepest > if (level >= deepestLevel) { > deepestNode = node;
// CORRECTION: This line is important. deepestLevel = level } > } > > // Now, add your new node to the deepest node > deepestNode.Nod es.Add(newNode) ; > > -vJ > > "Jeroen Ceuppens" <je************ *@barco.com> wrote in message > news:eg******** ******@TK2MSFTN GP10.phx.gbl... > > > > I need to put a new node at the end of the tree, that end is not
te lowest > > in de list but the deepest > > (the one with the most + before it) > > > > Node A > > Node 1 > > Node 2 > > Node 3 > > Node 4: Deepest > > Node B: not this one > > > > I need to Put everytime a new child to the Deepest so: > > > > first: > > Node A > > > > then > > > > Node A > > Node 1 > > > > then > > > > Node A > > Node 1 > > Node 2 > > > > and so on > > > > I tried many things, like TreeNodeCollect ion and > > treeViewSequenc e.Nodes.GetEnum erator() But i can't find a way to
fix this, > > it is difficult to get the child, help me.... > > > > Thx > > JC > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mike |
last post by:
I have an xml structure like:
<data>
<struct>1,8,7,30</struct>
</data>
and I need to develop a test that finds this node in each of these
cases, something like:
should find because 1 is in the node
|
by: pentium77 |
last post by:
Basically I have a situation where I need to update changes occuring
in one Text field of a table into another text field located in
another table. In addition both the tables are located in different
frames of a HTML page. So my question is can such an update be done ?
Is it necessary that the tables be located in the same frame for the
update to work ? Any pointers would be appreciated ?
Thanks,
-P.
|
by: Robert Oschler |
last post by:
What's a good way to find a specific text node element in a web page's DOM
tree? I thought of traversing each node but there has to be a faster way.
Is there a "find text node by nodeValue" function or something? I do know
the nodeValue (text string) of the text node.
Thanks.
|
by: Gregory Piñero |
last post by:
Hi,
Would anyone be able to tell me why my function below is getting stuck
in infinite recusion?
Maybe I'm just tired and missing something obvious?
def replace_within_node(node,oldnode,newnode):
if node is oldnode:
return newnode
else:
|
by: Goran Djuranovic |
last post by:
Hi All,
Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this:
<Root>
<Customer>
<Name>MyName</Name>
</Customer>
</Root>
I would like to retreive "\Root\Customer\Name" out of it. Something like:
| |
by: Goran Djuranovic |
last post by:
Hi All,
Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this:
<Root>
<Customer>
<Name>MyName</Name>
</Customer>
</Root>
I would like to retreive "\Root\Customer\Name" out of it. Something like:
|
by: mattrapoport |
last post by:
Hello - I am kinda new to the HTML DOM so I apologize in advance for my
ignorance.
I have a table made from divs. I am trying to write a script that
appends a new row to the table (by cloning the last row) and then
adding some text to the fields in that row. My script works perfectly
in IE but not even close in Firefox. Here's my HTML ...
HTML:
|
by: Bllich |
last post by:
can anyone post an algoritam for the deepest level
of a treeView ? it should be a recursive function I think..
I don't need treeView.Nodes.Level
because my users don't select the nodes...
I need to get a random node from the whole collection
so I want my
rndLevel = random.next(deepest level)
rndNode = random.next(number of nodes on that level)
to be able to get any node on any level in the collection.
|
by: SamKL |
last post by:
Hey, I'm no expert on PHP, and I have somewhat of an understanding of object oriented code. Anyway, getting right to the problem.
I'm using PHP4, so base it off of that. Basically I have 2 classes in this code.
Link_Structure, which is composed of Node classes (it's a linked list data structure), and of course the Node class.
In class Node:
function setActive( $i ) { $this->_data = $i; }
This function is designed to set the array...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |