473,396 Members | 1,812 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.

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(TreeNode node in trv_Directories.Nodes)
if(trv_Directories.GetChecked(node) !=
TriStateTreeView.CheckState.Unchecked)
GenerateModulesArray(node);

private void GenerateModulesArray(TreeNode nodes)
{
// Check to see if it's a single node
if(nodes.GetNodeCount(true) == 0)
if(trv_Directories.GetChecked(nodes) ==
TriStateTreeView.CheckState.Checked)
CompileModules.Add(nodes);
else
{
// Read the node and store into an arraylist
foreach (TreeNode node in nodes.Nodes)
{
if(trv_Directories.GetChecked(node) ==
TriStateTreeView.CheckState.Checked)
{
CompileModules.Add(node);
if(node.GetNodeCount(true) > 0)
GenerateModulesArray(node);
}
else if(trv_Directories.GetChecked(node) ==
TriStateTreeView.CheckState.GreyChecked)
{
if(node.GetNodeCount(true) > 0)
GenerateModulesArray(node);
else
CompileModules.Add(node);
}
}
}
}

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

private void RetreiveTreeView()
{
foreach(TreeNode node in CompileModules)
if(trv_Directories.Nodes.Contains(node.FullPath))
trv_Directories.SetChecked(node,
TriStateTreeView.CheckState.Checked);
}
On form_LOAD event:

// Check to see if the array is already populated
if(CompileModules.Count > 0)
RetreiveTreeView();

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

Somebody can help me with that?

Thanks!

Eduardo

Nov 17 '05 #1
0 2132

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

Similar topics

8
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...
0
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...
3
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...
10
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...
0
by: David | last post by:
Can WebControls be added to TreeNodes in the TreeView? David -- Be Positive Every Day
4
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...
0
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...
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: =?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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.