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);

//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.........


Karthikeyan S

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

but it not work in my system..

pls send ur coding to me.


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.

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


i am using


then it shows the treeview on the form.

Thank You.

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..

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

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