Toolbar button enabling/disabling

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to automatically enable and disable the toolbar buttons programmatically. For example, I have a tree control and and I want to disable toolbar buttons based on the currently selected node

Is there any easy way to do this

- Bruc
 
You can subscribe to the AfterSelect event of the TreeView control, and then
use a switch statement to selectively enable and disable buttons, as
appropriate. Of course, switch statements are the sources of countless bugs,
so an even better approach might be to store references to (names?) of the
buttons that each node should disable or enable either in the Tag of each
TreeNode, and then call that action (enable or disable) every time it
changes, thus keeping the information stored with the TreeNode itself.
 
* "=?Utf-8?B?YnJja2NjQG5vdmVsbC5jb20=?= said:
I need to automatically enable and disable the toolbar buttons
programmatically. For example, I have a tree control and and I want to
disable toolbar buttons based on the currently selected node.

\\\
Me.ToolBar1.Buttons(<Index>).Enabled = False
///
 
Back
Top