Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Field.CodeRange Property

Gets the range containing the field codes.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

DocumentRange CodeRange { get; }

Property Value

Type Description
DocumentRange

A DocumentRange object representing the range occupied by the field’s code.

Remarks

Use the CodeRange method to check field codes or to modify them.

document.BeginUpdate()

'Create a DATE field at the caret position
document.Fields.Create(document.CaretPosition, "DATE")
document.EndUpdate()
For i As Integer = 0 To document.Fields.Count - 1
    Dim fieldCode As String = document.GetText(document.Fields(i).CodeRange)
    If fieldCode = "DATE" Then
        'Retrieve the range obtained by the field code
        Dim position As DocumentPosition = document.Fields(i).CodeRange.End

        'Insert the format switch to the end of the field code range
        document.InsertText(position, "\@ ""M/d/yyyy h:mm am/pm""")
    End If
Next i

'Update all document fields
document.Fields.Update()

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

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.

See Also