Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created form using treeview control and populated all the values from the database - that works fine.

Category
---Sub Category
-----Item

To create New category (right click -> New) a form will be showd, after i created the new category - I have to add a node immediately to the tree view.

It is not working well.

Please let me know if you have any samples to clear this...

Thanks & Regards,
Senthil .R
Posted
Comments
[no name] 4-Jun-11 4:26am    
Just show your code what you have tried for this then we will guide you where you went wrong.

First off, don't try to to it in the form you display when they select "New" - that form should know nothing about how you display the data it collects. Instead, treat the "New" form in the same way that you do a OpenFileDialog form: create it, set up it's parameters, display it, and then use the properties to tell you what the user did.
MyNewItemForm myForm = new MyNewItemForm()
if (myForm.ShowDialog() == DialogResult.OK)
   {
   string item = myForm.NewDataEnteredByTheUser;
   TreeNode t = new TreeNode(item);
   myExistingNode.Nodes.Add(t);
   }
 
Share this answer
 
Hope this[^] might help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900