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. Windows Forms
  4. Treeview - preventing node selection

Treeview - preventing node selection

Scheduled Pinned Locked Moved Windows Forms
question
2 Posts 2 Posters 0 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.
  • A Offline
    A Offline
    AnthonyEllis
    wrote on last edited by
    #1

    Hi, Upon clicking a treeview node, the following events fire (correct me if I am mistaken) - Click and AfterSelect. In the Click event I want to perform a test and optionally prevent the node that was clicked upon from being selected. I think I have to prevent the execution flow from reaching AfterSelect? Is there a way of "cancelling" the click event or otherwise achieving this? I do have a work around - a form level boolean variable that I set True if I want to cancel - in AfterSelect if this is set True then it exits the AfterSelect event handler function. But this seems at best a kludge. Many thanks in advance! - Anthony

    P 1 Reply Last reply
    0
    • A AnthonyEllis

      Hi, Upon clicking a treeview node, the following events fire (correct me if I am mistaken) - Click and AfterSelect. In the Click event I want to perform a test and optionally prevent the node that was clicked upon from being selected. I think I have to prevent the execution flow from reaching AfterSelect? Is there a way of "cancelling" the click event or otherwise achieving this? I do have a work around - a form level boolean variable that I set True if I want to cancel - in AfterSelect if this is set True then it exits the AfterSelect event handler function. But this seems at best a kludge. Many thanks in advance! - Anthony

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      AnthonyEllis wrote:

      But this seems at best a kludge.

      Sometimes that just happens to be the only case.

      "I really like comments where I don't have to answer stupid questions" - stfx

      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