Back to Devexpress

Command.Execute() Method

corelibraries-devexpress-dot-utils-dot-commands-dot-command.md

latest3.9 KB
Original Source

Command.Execute() Method

Executes the command on the current command target.

Namespace : DevExpress.Utils.Commands

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public virtual void Execute()
vb
Public Overridable Sub Execute

Remarks

The Execute method checks the command state before executing, and decides whether the action can be performed. In case you want to execute an action if the command cannot be executed, use the Command.ForceExecute method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Execute() 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-pdf-viewer-replace-standard-command-with-custom-command/CS/ViewerCustomCommand/CustomNextPageCommand.cs#L14

csharp
MessageBox.Show("Custom command executed");
    base.Execute();
}

winforms-richedit-table-of-contents-practical-guide/CS/Form1.cs#L24

csharp
private void btnShowAllFieldCodes_Click(object sender, EventArgs e) {
    new ShowAllFieldCodesCommand(richEditControl1).Execute();
}

how-to-custom-draw-in-pdf-viewer/CS/PDF_Viewer/Form1.cs#L30

csharp
{
    base.Execute();
    return;

winforms-pdf-viewer-replace-standard-command-with-custom-command/VB/ViewerCustomCommand/CustomNextPageCommand.vb#L16

vb
MessageBox.Show("Custom command executed")
    MyBase.Execute()
End Sub

winforms-richedit-table-of-contents-practical-guide/VB/Form1.vb#L32

vb
Private Sub btnShowAllFieldCodes_Click(ByVal sender As Object, ByVal e As EventArgs)
    Call New ShowAllFieldCodesCommand(richEditControl1).Execute()
End Sub

how-to-custom-draw-in-pdf-viewer/VB/PDF_Viewer/Form1.vb#L30

vb
If rectangles Is Nothing OrElse rectangles.Count = 0 Then
    MyBase.Execute()
    Return

See Also

ForceExecute(ICommandUIState)

Command Class

Command Members

DevExpress.Utils.Commands Namespace