Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
if click a childnode in a treeview i need to go another form in c# windows application
Posted

1 solution

Try something like this:
C#
private void Form1_Load(object sender, EventArgs e)
       {
           PopulateTreeView();
           this.treeView1.DoubleClick += new EventHandler(treeView1_DoubleClick);
       }
       private void treeView1_DoubleClick(object sender, EventArgs e)
       {
           TreeView tView = (TreeView)sender;
           switch (tView.SelectedNode.Text)
           {
               case "Dog":
                   MessageBox.Show("Open the window related to Dog");
                   break;
               case "Cat":
                   MessageBox.Show("Open the window related to Cat");
                   break;
               case "Monkey":
                   MessageBox.Show("Open the window related to Monkey");
                   break;
           }
       }
 
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