click one treenode but it didn't response ,why
-
Hi,everyone!I used a treeview control in a splitcontainer,I want it to work like frame web:when I click one node,some controls display on right.I wrote the NodeMouseClick Event like these: Private Sub treeQiaoTi_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles treeQiaoTi.NodeMouseClick If e.Node.Text = "abc" Then panJieGuan2.Visible = False Panel1.Visible = True Else Panel1.Visible = False panJieGuan2.Visible = True End If End Sub When I clicked the node "abc",the panel1 displayed on right,but after I clicked other nodes,panJieGuan2 is not shown. panel1 and panJieGuan2 were all on splitcontainer right panel,panJieGuan2 was above panel1. PLZ give me some suggestions and help me !!THX!
-
Hi,everyone!I used a treeview control in a splitcontainer,I want it to work like frame web:when I click one node,some controls display on right.I wrote the NodeMouseClick Event like these: Private Sub treeQiaoTi_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles treeQiaoTi.NodeMouseClick If e.Node.Text = "abc" Then panJieGuan2.Visible = False Panel1.Visible = True Else Panel1.Visible = False panJieGuan2.Visible = True End If End Sub When I clicked the node "abc",the panel1 displayed on right,but after I clicked other nodes,panJieGuan2 is not shown. panel1 and panJieGuan2 were all on splitcontainer right panel,panJieGuan2 was above panel1. PLZ give me some suggestions and help me !!THX!
Have a look at this link click here but a snippet here shows how to read a selected node into a label
Public Class Form12 Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "#End Region
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As_
System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Label1.Text = "You are here->" & " " & e.Node.FullPath
'displaying the path of the selected node
Label2.Text = "Current node selected:" & " " & e.Node.Text
'displaying the selected node
End SubEnd Class
As barmey as a sack of badgers
-
Have a look at this link click here but a snippet here shows how to read a selected node into a label
Public Class Form12 Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "#End Region
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As_
System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Label1.Text = "You are here->" & " " & e.Node.FullPath
'displaying the path of the selected node
Label2.Text = "Current node selected:" & " " & e.Node.Text
'displaying the selected node
End SubEnd Class
As barmey as a sack of badgers
-
Hi,Simon!Emmmmm...I think your suggestion is that I should write other event to get selectnode?
something else you could try is on your current method is messagebox.show TreeView1.SelectedNode.Text where treeview1 is the name of your treeview
As barmey as a sack of badgers
-
something else you could try is on your current method is messagebox.show TreeView1.SelectedNode.Text where treeview1 is the name of your treeview
As barmey as a sack of badgers
Simon,I use msgbox to show the select node,I found that it got forcus on mouse click,emm...,I means when I click "123",the e.node is really "123",and this time the controls occured. But I found another question.For example,Panel 2 was on Panel 1,Panel 2 relies on Panel 1.I want when I clicked node 1,Panel 1 should display;when I clicked node 2,Panel 2 should display.Could you tell me how could do this?:confused: Thanks a lot!
-
Hi,everyone!I used a treeview control in a splitcontainer,I want it to work like frame web:when I click one node,some controls display on right.I wrote the NodeMouseClick Event like these: Private Sub treeQiaoTi_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles treeQiaoTi.NodeMouseClick If e.Node.Text = "abc" Then panJieGuan2.Visible = False Panel1.Visible = True Else Panel1.Visible = False panJieGuan2.Visible = True End If End Sub When I clicked the node "abc",the panel1 displayed on right,but after I clicked other nodes,panJieGuan2 is not shown. panel1 and panJieGuan2 were all on splitcontainer right panel,panJieGuan2 was above panel1. PLZ give me some suggestions and help me !!THX!
If panel1 is a child of panel2 OR Panel2 is a child of Panel1 you'll never see child panelin your form. Check the following Code:
Private Sub treeQiaoTi_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles treeQiaoTi.NodeMouseClick
Me.Text = e.Node.Text ' real text in clicked node.
If e.Node.Text = "abc" Then 'Check this abc
panJieGuan2.Visible = False
Panel1.Visible = True
Panel1.BringToFront() 'Check it
Else
Panel1.Visible = False
panJieGuan2.Visible = True
panJieGuan2.BringToFront() 'It too
End If
End SubThis is not Necessary yet:
Private Sub treeQiaoTi_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles treeQiaoTi.AfterSelect
End SubUse <pre lang="vb"> Visual Basic Code Here.</pre>
-
If panel1 is a child of panel2 OR Panel2 is a child of Panel1 you'll never see child panelin your form. Check the following Code:
Private Sub treeQiaoTi_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles treeQiaoTi.NodeMouseClick
Me.Text = e.Node.Text ' real text in clicked node.
If e.Node.Text = "abc" Then 'Check this abc
panJieGuan2.Visible = False
Panel1.Visible = True
Panel1.BringToFront() 'Check it
Else
Panel1.Visible = False
panJieGuan2.Visible = True
panJieGuan2.BringToFront() 'It too
End If
End SubThis is not Necessary yet:
Private Sub treeQiaoTi_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles treeQiaoTi.AfterSelect
End SubUse <pre lang="vb"> Visual Basic Code Here.</pre>