Version

Accomplish Simple Tasks with the PerformAction Method

WinFormattedTextEditor™ includes several KeyActionMappings that make the end user’s word processing experience more convenient. Each of these mappings have an associated action along with them. For a complete list of default KeyActionMappings, see Default KeyActionMappings for WinFormattedTextEditor. By using the PerformAction method off the EditInfo object, you can perform any action through code that the end user can perform with their keyboard.

The following code demonstrates how to clear the contents of the WinFormattedTextEditor control by selecting all the text and then deleting it. If you want to make sure that the document is blank when your application opens, you can place this code in the FormLoad event.

In Visual Basic:

Imports Infragistics.Win.FormattedLinkLabel
Private Sub Accomplish_Simple_Tasks_with_the_PerformAction_Method_Load( _
  ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.UltraFormattedTextEditor1.EditInfo.PerformAction( _
          FormattedLinkEditorAction.SelectAll)
        Me.UltraFormattedTextEditor1.EditInfo.PerformAction( _
          FormattedLinkEditorAction.Delete)
End Sub

In C#:

using Infragistics.Win.FormattedLinkLabel;
private void Accomplish_Simple_Tasks_with_the_PerformAction_Method_Load(
  object sender,
  EventArgs e)
{
        this.ultraFormattedTextEditor1.EditInfo.PerformAction(
          FormattedLinkEditorAction.SelectAll);
        this.ultraFormattedTextEditor1.EditInfo.PerformAction(
          FormattedLinkEditorAction.Delete);
}