calling forms from treeview nodes
-
Hi i want select a node from treeview nodes and call the form that i have selected its node. here is my code. node1 = "Company"; node2 = "Process"; node3 = "Script"; node4 = "Group"; node5 = "User"; if (node1 == "Company" ) { cmsCompany.Show(); } else if (node2 == "Process") { cmsProcess.Show(); } else if (node3 == "Script") { cmsScript.Show(); } else if (node4 == "Group") { cmsGroup.Show(); } else if (node5 == "User") { cmsUser.Show(); }
Mamphekgo
-
Hi i want select a node from treeview nodes and call the form that i have selected its node. here is my code. node1 = "Company"; node2 = "Process"; node3 = "Script"; node4 = "Group"; node5 = "User"; if (node1 == "Company" ) { cmsCompany.Show(); } else if (node2 == "Process") { cmsProcess.Show(); } else if (node3 == "Script") { cmsScript.Show(); } else if (node4 == "Group") { cmsGroup.Show(); } else if (node5 == "User") { cmsUser.Show(); }
Mamphekgo
Hello, I think the 'AfterSelect' event will help you.
//Constructor code yourTreeView.AfterSelect+=new TreeViewEventHandler(yourTreeView_AfterSelect); private void yourTreeView_AfterSelect(object sender, TreeViewEventArgs e) { switch(yourTreeView.SelectedNode.Text) { case "Company": cmsCompany.Show(); break; case "Process": cmsProcess.Show(); break; case "Script": cmsScript.Show(); break; default: break; } }
All the best, Martin
-
Hello, I think the 'AfterSelect' event will help you.
//Constructor code yourTreeView.AfterSelect+=new TreeViewEventHandler(yourTreeView_AfterSelect); private void yourTreeView_AfterSelect(object sender, TreeViewEventArgs e) { switch(yourTreeView.SelectedNode.Text) { case "Company": cmsCompany.Show(); break; case "Process": cmsProcess.Show(); break; case "Script": cmsScript.Show(); break; default: break; } }
All the best, Martin
Whenever I see code like this, it makes me think that there's a Factory missing somewhere (and I'm not having a go at your code here - it's the OP requirement that is prompting me here). I hope that he's managing his form disposal as well, but I bet that he isn't.
Deja View - the feeling that you've seen this post before.
-
Whenever I see code like this, it makes me think that there's a Factory missing somewhere (and I'm not having a go at your code here - it's the OP requirement that is prompting me here). I hope that he's managing his form disposal as well, but I bet that he isn't.
Deja View - the feeling that you've seen this post before.
Hello Pete,
Pete O`Hanlon wrote:
it makes me think that there's a Factory missing somewher
So true!!! (Got my 5 for that)
Pete O`Hanlon wrote:
I hope that he's managing his form disposal as well
You are write, I should allways point this out at answers.
Pete O`Hanlon wrote:
but I bet that he isn't.
Let's wait and see, what he is answering.
All the best, Martin