Command Checked

The CommandChecked event occurs whenever a menu bar command becomes checked or unchecked or a toolbar command's state changes from pressed to not pressed and vice versa. Because the same command can be accessed from multiple locations (toolbar, menu bar, shortcut menu), this event will fire for each command. The CommandChecked event takes the following two arguments:

Command — Returns a PivotCommandId constant and allows you to determine which command has been checked or unchecked. You can use the Object Browser to view the list of commands for this constant. Checked — An object whose Value property indicates whether the command is checked or unchecked.

For example, the Sort Ascending command is available on the menu bar, toolbar, and shortcut menu of the form. Whenever the Sort Ascending command becomes checked or unchecked, the CommandChecked event will fire at least three times.

The event procedure in Hands-On 24-32 checks whether the SortAscending command has been checked or unchecked.

0 0

Post a comment