corelibraries-devexpress-dot-utils-dot-commands-dot-command-dot-forceexecute-x28-devexpress-dot-utils-dot-commands-dot-icommanduistate-x29.md
Performs a command action regardless of a command state.
Namespace : DevExpress.Utils.Commands
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
public abstract void ForceExecute(
ICommandUIState state
)
Public MustOverride Sub ForceExecute(
state As ICommandUIState
)
| Name | Type | Description |
|---|---|---|
| state | ICommandUIState |
An ICommandUIState interface defining the command state.
|
The following code snippet illustrates the typical use of the ForceExecute method.
using DevExpress.Utils.Commands;
// ...
ICommandUIState state = cmd.CreateDefaultCommandUIState();
cmd.UpdateUIState(state);
// check command state
if (state.Enabled)
{
cmd.ForceExecute(state);
}
Imports DevExpress.Utils.Commands
' ...
Private state As ICommandUIState = cmd.CreateDefaultCommandUIState()
cmd.UpdateUIState(state)
' check command state
If state.Enabled Then
cmd.ForceExecute(state)
End If
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ForceExecute(ICommandUIState) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L520
RichEditCommand capCommand = richEdit.CreateCommand(RichEditCommandId.CapitalizeEachWordTextCase);
capCommand.ForceExecute(capCommand.CreateDefaultCommandUIState());
winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L529
Dim capCommand As RichEditCommand = richEdit.CreateCommand(RichEditCommandId.CapitalizeEachWordTextCase)
capCommand.ForceExecute(capCommand.CreateDefaultCommandUIState())
See Also