Andrew,
Thre is no BeforeLeaving event, but there is BeforeSelect event that covers
exactly your case.
Handle this event and check SelectedNode (this is the node that currently is
selected). Do the validation and if the data haven't been saved yet, set the
event argument's property Cancel to *true* this will cancel changing the
selection and will keep the previously selected node.
HTH
Stoitcho Goutsev (100) [C# MVP]
"Andrew Ducker" <an****@ducker.org.uk> wrote in message
news:11********************@g14g2000cwa.googlegrou ps.com...
I have a treeview linked to a series of panels, making the correct
panel visible depending on which node is selected.
I now want to check that the user is allowed to leave the current node
they're on before letting them do so (popping up a "You have unsaved
data - save?" box).
However, there doesn't seem to be a "BeforeLeaving" event that fires
before focus changes from one node to another.
Am I missing something, or do I have to just code my way around it?
Cheers,
Andy D