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. C#
  4. treeview afterselect problem

treeview afterselect problem

Scheduled Pinned Locked Moved C#
helpdebuggingquestion
5 Posts 4 Posters 2 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.
  • R Offline
    R Offline
    Rick van Woudenberg
    wrote on last edited by
    #1

    Dear all, I have two treeviews on my form , and the afterselect method on both of them is like this : private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { tabControl1.Visible = false; } private void treeView2_AfterSelect(object sender, TreeViewEventArgs e) { tabControl1.Visible = true; } The problem that I have, is that the tabcontrol that I would like to hide or show, only hides or shows once. After that, nothing happens anymore if I click on either treeviews. I tried attaching a messagebox to the methodes for debug reasons, but they don't show either. It looks like the afterselect method is not being called the second or third time I click on it. Can anyone help me out please ? kind regards, Rick

    B 1 Reply Last reply
    0
    • R Rick van Woudenberg

      Dear all, I have two treeviews on my form , and the afterselect method on both of them is like this : private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { tabControl1.Visible = false; } private void treeView2_AfterSelect(object sender, TreeViewEventArgs e) { tabControl1.Visible = true; } The problem that I have, is that the tabcontrol that I would like to hide or show, only hides or shows once. After that, nothing happens anymore if I click on either treeviews. I tried attaching a messagebox to the methodes for debug reasons, but they don't show either. It looks like the afterselect method is not being called the second or third time I click on it. Can anyone help me out please ? kind regards, Rick

      B Offline
      B Offline
      Bekjong
      wrote on last edited by
      #2

      The AfterSelect event fires after you select a specific node on the treeview, not the treeview itself. Once this has been selected, it will not fire again untill you select another node on the same tree. Sounds like what you want is to simply perform an action when a treeview is clicked, so you might as well use the Click event. Hope this helps.

      Standards are great! Everybody should have one!

      J 1 Reply Last reply
      0
      • B Bekjong

        The AfterSelect event fires after you select a specific node on the treeview, not the treeview itself. Once this has been selected, it will not fire again untill you select another node on the same tree. Sounds like what you want is to simply perform an action when a treeview is clicked, so you might as well use the Click event. Hope this helps.

        Standards are great! Everybody should have one!

        J Offline
        J Offline
        John_Adams
        wrote on last edited by
        #3

        Hi, Please try the following code snippet: BEGIN CODE private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { this.tabControl1.Visible = false; } private void treeView2_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { this.tabControl1.Visible = true; } END CODE I hope this helps :).

        Regards, John Adams ComponentOne LLC

        B 1 Reply Last reply
        0
        • J John_Adams

          Hi, Please try the following code snippet: BEGIN CODE private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { this.tabControl1.Visible = false; } private void treeView2_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { this.tabControl1.Visible = true; } END CODE I hope this helps :).

          Regards, John Adams ComponentOne LLC

          B Offline
          B Offline
          Bekjong
          wrote on last edited by
          #4

          Thanks, but I don't need any help, you might want to reply to the original poster ;).

          Standards are great! Everybody should have one!

          X 1 Reply Last reply
          0
          • B Bekjong

            Thanks, but I don't need any help, you might want to reply to the original poster ;).

            Standards are great! Everybody should have one!

            X Offline
            X Offline
            Xmen Real
            wrote on last edited by
            #5

            :laugh: i think he was in hurry

            TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can

            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