Skip to main content
.NET Framework 4.5.2+

AutoCorrectEventArgs.AutoCorrectInfo Property

Gets or sets the AutoCorrectInfo object that provides methods to analyze input text and contains a replacement object.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v22.1.Core.dll


public AutoCorrectInfo AutoCorrectInfo { get; set; }

Property Value

Type Description

An AutoCorrectInfo object.


The AutoCorrectInfo is the main source of information used in handling the AutoCorrect event.

The following code sample shows how to handle the RichEditControl.AutoCorrect event to replace the typed $ symbol with a picture of a dollar, and substitute the text enclosed in percent symbols with custom content.

Use the AutoCorrectEventArgs.AutoCorrectInfo property to obtain the document text, then call the AutoCorrectInfo.DecrementStartPosition method to expand its left boundary until a special symbol or a word separator symbol is found. Use the AutoCorrectInfo.ReplaceWith property to pass a replacement object (a string or an image) to the document if a resulting string meets certain conditions, such as whether it is a dollar sign or a %date% string.

Private Sub richEditControl1_AutoCorrect(ByVal sender As Object, ByVal e As DevExpress.XtraRichEdit.AutoCorrectEventArgs) Handles richEditControl1.AutoCorrect
    Dim info As AutoCorrectInfo = e.AutoCorrectInfo
    e.AutoCorrectInfo = Nothing

    If info.Text.Length <= 0 Then
    End If
        If Not info.DecrementStartPosition() Then
        End If

        If IsSeparator(info.Text(0)) Then
        End If

        If info.Text(0) = "$"c Then
            info.ReplaceWith = CreateImageFromResx("dollar_pic.png")
            e.AutoCorrectInfo = info
        End If

        If info.Text(0) = "%"c Then
            Dim replaceString As String = CalculateFunction(info.Text)
            If Not String.IsNullOrEmpty(replaceString) Then
                info.ReplaceWith = replaceString
                e.AutoCorrectInfo = info
            End If
        End If
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the AutoCorrectInfo property.


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.

See Also