System.Windows.Forms.TreeView.BeforeCheck Event

Occurs before the tree node check box is checked.

Syntax

public event TreeViewCancelEventHandler BeforeCheck

Remarks

Note:

Setting the TreeNode.Checked property from within the TreeView.BeforeCheck or TreeView.AfterCheck event causes the event to be raised multiple times and can result in unexpected behavior. For example, you might set the TreeNode.Checked property in the event handler when you are recursively updating the child nodes, so that the user does not have to expand and check each one individually. To prevent the event from being raised multiple times, add logic to your event handler that only executes your recursive code if the TreeViewEventArgs.Action property of the System.Windows.Forms.TreeViewEventArgs is not set to TreeViewAction.Unknown.

For more information about how to handle events, see Consuming Events.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0