I am using a treeview control in vb.net. I need to provide functionality that allows only one node to be checked at time. I am trying to avoid iterating through all the nodes (there could potentially be quite a few) by keeping a reference to the last node checked in a static variable. When the user checks another node I basically uncheck the referenced node and set the reference to the newly checked node. I also need the ability to programatically check all children of a checked node.
I have placed some code in the AfterCheck event which, of course, fires the AfterCheck event when the previously checked node is unchecked or when another node is checked programatically. Therein lies my problem. I have tried putting the code the Click event but that does not fire until the mouse button is released. This poses a problem if the user moves the mouse off the checked node before they release the mouse button so I lose the node that was checked (I'm using the GetNodeAt method of the tree to get a reference to the affected node).
If anyone can suggest another approach or a way around this problem it would be most appreciated.
Thanks
I have placed some code in the AfterCheck event which, of course, fires the AfterCheck event when the previously checked node is unchecked or when another node is checked programatically. Therein lies my problem. I have tried putting the code the Click event but that does not fire until the mouse button is released. This poses a problem if the user moves the mouse off the checked node before they release the mouse button so I lose the node that was checked (I'm using the GetNodeAt method of the tree to get a reference to the affected node).
If anyone can suggest another approach or a way around this problem it would be most appreciated.
Thanks