473,796 Members | 2,520 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeNodes collection

Hi all

I have a treeview in a form that I need to store inside a nodes
collection so I'll not loose the values when I change between screens.

What I'm doing is store all the checked nodes into a ArrayList and then
retreive them:

// Generate the arraylist with the modules that are checked
foreach(TreeNod e node in trv_Directories .Nodes)
if(trv_Director ies.GetChecked( node) !=
TriStateTreeVie w.CheckState.Un checked)
GenerateModules Array(node);

private void GenerateModules Array(TreeNode nodes)
{
// Check to see if it's a single node
if(nodes.GetNod eCount(true) == 0)
if(trv_Director ies.GetChecked( nodes) ==
TriStateTreeVie w.CheckState.Ch ecked)
CompileModules. Add(nodes);
else
{
// Read the node and store into an arraylist
foreach (TreeNode node in nodes.Nodes)
{
if(trv_Director ies.GetChecked( node) ==
TriStateTreeVie w.CheckState.Ch ecked)
{
CompileModules. Add(node);
if(node.GetNode Count(true) > 0)
GenerateModules Array(node);
}
else if(trv_Director ies.GetChecked( node) ==
TriStateTreeVie w.CheckState.Gr eyChecked)
{
if(node.GetNode Count(true) > 0)
GenerateModules Array(node);
else
CompileModules. Add(node);
}
}
}
}

And then when I get back to the screen I do this:

private void RetreiveTreeVie w()
{
foreach(TreeNod e node in CompileModules)
if(trv_Director ies.Nodes.Conta ins(node.FullPa th))
trv_Directories .SetChecked(nod e,
TriStateTreeVie w.CheckState.Ch ecked);
}
On form_LOAD event:

// Check to see if the array is already populated
if(CompileModul es.Count > 0)
RetreiveTreeVie w();

It gets inside the RetreiveTreeVie w routine, but the Contains method is
not finding the nodes.

Somebody can help me with that?

Thanks!

Eduardo

Nov 17 '05 #1
0 2146

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

Similar topics

8
2217
by: Generic Usenet Account | last post by:
To settle the dispute regarding what happens when an "erase" method is invoked on an STL container (i.e. whether the element is merely removed from the container or whether it also gets deleted in the process), I looked up the STL code. Erase certainly does not delete the memory associated with the element. However, it appears that the destructor on the element is invoked. I wonder why it has to be this way. In my opinion, this renders...
0
2420
by: Norbert Heidbüchel | last post by:
Hi all, I have read a lot of postings and web pages about drag and drop and treeviews, but could not find an answer to my problem. Sorry, if I missed something. I am trying to drag and drop treenodes defined by myself and don't understand, how to get the nodes data in the dragdrop event. I'm not very experienced in .NET and for sure there is a simple solution. I've written a short sample program, based on well known examples,
3
2710
by: Kilroy Programmer | last post by:
Is there a way to store a unique numeric identifier (say, for example, an int) into a TreeNode, so that when the TreeNode is checked (since CheckBoxes is enabled) the eventhandler AfterCheck() can examine the responsible Node's identifier to see which TreeNode triggered the event? Analyzing the Node's Text string is undesirable because it would mean performing a string compare to a set of predefined strings. This is slower and not easily...
10
1762
by: DrPete | last post by:
Hi People Could anyone suggest to me the best way to distinguish treenodes? By this I mean I'm in a situation where I have a TreeNode that displays a number of categories and within those nodes there are items of stock. There are a number of things I wish to do, such as use a ContextMenu to Rename the node, but I can't seemingly tell if the Node I'm renaming is a category or an item of stock.
0
1120
by: David | last post by:
Can WebControls be added to TreeNodes in the TreeView? David -- Be Positive Every Day
4
12020
by: Alan T | last post by:
I want to search the whole tree of a root node if one node has a tag value is matched. I have added tree nodes into a tree view with tag value is assigned to each node. If I want to find out the node has tag value say 10, how do I search thro' the whole tree ?
0
1226
by: SBelzile | last post by:
Hi, We are working on a vb.net WinForms project based on the Composite UI Application Block (VS2005). I have a strange problem. At first, I thought 10 minutes would be fairly enough for me to solve it but I've spent almost 6 hours on it today and still can't figure out what's wrong. Using the CAB, I have built a control that intercepts messages coming from other CAB's SmartParts controls and display them into a treeview control. The...
1
1907
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
2191
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
My first time using a TreeView: I've got a TreeView that I populated with some data and it has nodes. In the Properties window, I created an Event Handler for the TreeView's AfterSelect method, and it allows me to determine what Tree Node has been selected. However, if I expand the TreeView and select one of the Child TreeNodes, they do not trigger this event.
0
9680
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
10456
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
10230
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...
0
10012
tracyyun
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...
0
9052
agi2029
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...
1
7548
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
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5442
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
4118
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

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.