Click here to Skip to main content
15,910,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Let us consider tvPlant is tree view, In that have 5 nodes Tv1,Tv2,Tv3,Tv4,Tv5,Now user select the Tv4 node then it opens another window ,here choose some picture and close that window,Again user select that same node"TV4",Now its not open window if user select other than TV4, after that select TV4,Then its open.I need to open the window when user select at any time


Please help me
Posted
Updated 23-Apr-12 21:09pm
v2

I think the NodeMouseClick event of the TreeView may be used for this purpose, as shown below

VB
Sub Main
    Dim form1 As New Form()
    
    Dim treeView1 As New TreeView()
    treeView1.Nodes.Add("N1")
    treeView1.Nodes.Add("N2")
    treeView1.Nodes.Add("N3")
    treeView1.Nodes.Add("N4")
    AddHandler treeView1.NodeMouseClick, addressof treeView1_NodeClicked
    form1.Controls.Add(treeView1)
    
    form1.ShowDialog()
End Sub

public shared sub treeView1_NodeClicked(sender, args)
    MessageBox.Show("Node clicked")
End sub
 
Share this answer
 
v3
Comments
ajay.anilmaddi 24-Apr-12 5:02am    
ThankQ
VJ Reddy 24-Apr-12 12:10pm    
You're welcome.
Thank you for the response.
If the answer is helpful then you may consider to accept the solution using the accept solution button in the title of the solution.
VB
Private Sub tvPlants_NodeMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles tvPlants.NodeMouseClick
       tvPlants.CollapseAll()
       tvPlants.ExpandAll()
   End Sub
 
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