Jump to content

TreeView Help

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
hi all,
i wanted to fill a TreeView control from a text files, where a text file holds a root and each root has another text file with the nodes or children of this root.

the problem is in adding the roots and nodes to the tree view, because it needs a "treeNode[]" array, and offcourse the array needs a constant which i dont know what it could be, and it doesnt allow null values in the array.
---so plz if u can offer any suggestion , go ahead :)
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#2
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
By constant, do you mean a length of array? You mean you have to set the size of the array as you create it?

Why not add the items individually?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#3
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
yes you are right, but i think this applies if the TreeView have only individual nodes without children.
im not sure if am right though, so please can you explain more or write samle code.
thnx for ur reply
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#4
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
If you want to add a node to a tree with children:
//Add the node.
//But keep a reference to it.
TreeNode node = tree.Nodes.Add("Lvl 1 node");
//Add a child node to the referenced object.
node.Nodes.Add("Lvl 2 node");

Edited by Xav, 20 August 2008 - 12:04 PM.
Code typo

Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#5
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
thnx lot xav you are a genius, its simple and easy
i would have probably given up:)

it worked with a small modification by using (node.Nodes .Add("level 2 node");
because there isnt a childnode class or method.
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#6
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Whoops, sorry! I did mean Nodes, but I typed ChildNodes by accident, I got mixed up with XML. :)

I'm glad you got it going!
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums