Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. click one treenode but it didn't response ,why

click one treenode but it didn't response ,why

Scheduled Pinned Locked Moved Visual Basic
help
7 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sanyexian
    wrote on last edited by
    #1

    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!

    S S 2 Replies Last reply
    0
    • S sanyexian

      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!

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      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 Sub

      End Class

      As barmey as a sack of badgers

      S 1 Reply Last reply
      0
      • S Simon_Whale

        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 Sub

        End Class

        As barmey as a sack of badgers

        S Offline
        S Offline
        sanyexian
        wrote on last edited by
        #3

        Hi,Simon!Emmmmm...I think your suggestion is that I should write other event to get selectnode?

        S 1 Reply Last reply
        0
        • S sanyexian

          Hi,Simon!Emmmmm...I think your suggestion is that I should write other event to get selectnode?

          S Offline
          S Offline
          Simon_Whale
          wrote on last edited by
          #4

          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

          S 1 Reply Last reply
          0
          • S Simon_Whale

            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

            S Offline
            S Offline
            sanyexian
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0
            • S sanyexian

              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!

              S Offline
              S Offline
              slam Iqbal
              wrote on last edited by
              #6

              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 Sub

              This is not Necessary yet:

              Private Sub treeQiaoTi_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles treeQiaoTi.AfterSelect
              End Sub

              Use <pre lang="vb"> Visual Basic Code Here.</pre>

              S 1 Reply Last reply
              0
              • S slam Iqbal

                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 Sub

                This is not Necessary yet:

                Private Sub treeQiaoTi_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles treeQiaoTi.AfterSelect
                End Sub

                Use <pre lang="vb"> Visual Basic Code Here.</pre>

                S Offline
                S Offline
                sanyexian
                wrote on last edited by
                #7

                Hi,Aslam,thank you very much!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups