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

Recommended Answers

All 8 Replies

i get that one from some other forums.

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.

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.

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.