954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to create the treeview during runn tim

hi,

i am created the view at run time using the following code


TreeView myTreeView = new TreeView();
myTreeView.Location = new Point(0,0);
myTreeView.Size = new Size(100,200);
this.Controls.Add(myTreeView);

//now that it's on the form, you can add nodes to it
myTreeView.Nodes.Add(new TreeNode("something");

but runtime the tree view not displayed in the form. any other thing is need. please give ur suggestions.........


Regards,

Karthikeyan S

karthi_selva
Junior Poster in Training
65 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

i get that one from some other forums.

karthi_selva
Junior Poster in Training
65 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

it appeared on my form when I pasted that into a button and then ran it and clicked it.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

but it not work in my system..

pls send ur coding to me.

karthi_selva
Junior Poster in Training
65 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

Um

Make new project
drop a button on the form
double click on it
paste in the code you posted

That is all I did.
If yours isnt working, Id suggest your code isnt running - try debugging it.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

hi thank u

actualy i am using that code inside the splitcontainer. so i am not able to view at runtime.(its my mistake)

instead of using

this.control.add(treeview)

i am using

splitContainer.panel.control.add(treeview)

then it shows the treeview on the form.

Thank You.

karthi_selva
Junior Poster in Training
65 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

if there is possible to create more than one treeview at run time?

i am using the one function createtreeview()

if i use recursively. the new treeview must be create.

but i do't know how is it possible.

if possible please send the details..

karthi_selva
Junior Poster in Training
65 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

It would but your code there would place them on top of each other.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

As you appear to have got past this, please mark it as solved

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You