Windows Develop Bookmark and Share   
 index > Windows Forms General > fullpath of secondsubnode gets into fullpath of first subnode
 

fullpath of secondsubnode gets into fullpath of first subnode

Hi All,

I am facing problem in treenode.

I make a treenode.

when i try to add various subnodes in nested loops,

For subnodes, it gives problem ofin treenode.tag and treenode.text.

Treenode.text gets set properly for the first subnode of a node while in case of tagnode.tag ,fullpath of secondsubnode gets in fullpath of first subnode.

so first subnode starts pointing to second subnode.

Any solutions.

Is there any precaution to be taken while adding nodes and subnodes in recursive and nested form.

regards

Bhaskar Sharma  Tuesday, September 05, 2006 1:33 PM
You're probably mixing up node references. Show us your code please...
nobugz  Tuesday, September 05, 2006 3:07 PM

Hi nobuz

Thanks for you reply.The code used by me is very big, however i am herewith giving abrief of it below.assume that ihave already created thetreeview

TreeNode tr = new TreeNode("first major node",0,0)

foreach (objienumerator in objarraylist)

foreach(objienumerator1 in objarraylist1)

{

objenumerator.property1= objienumerator1.property1;

objenumerator.property2= objienumerator1.property2;

TreeNodernode = new TreeNode("subnode",1,1);

rnode.Checked = true;

rnode.Tag = objienumerator;

tr.Nodes.Add(rnode);

}

}

Now what happens that when i am finished with the iterations, i end up with all subnodes having the same value.I am able to mange having different text for them but tag property of all gets setted to the last value of objienumerator;

Due to some application constraint,I can't use any other object(like objienumerator1) other than objienumerator.

All other things are created properly in the tree.

Can somebody please help me how to deal with this.

regards

Bhaskar Sharma  Wednesday, September 06, 2006 12:42 PM

You can use google to search for other answers

Custom Search

More Threads

• Drag and drop Form movement
• RSACryptoServiceProvider encryption
• RichTextBox Line Spacing
• Adding controls to the same location on a Canvas (in code)
• Cannot create a child list for field
• Combobox - bold items
• TreeView for Menu - Newbie
• Logged In Windows User
• Order of visible windows
• contextMenu associated window shown in taskbar