Version

ReadOnly Property (UltraTextEditor)

Syntax
'Declaration
 
Public Property ReadOnly As Boolean
public bool ReadOnly {get; set;}
Example
This example uses the text selection-related properties to demonstrate how text can be selected programmatically, and how the selection can then be replaced. It also uses the ReadOnly property to prevent the text from being changed by the end user.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinEditors

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '	Set focus to the control so we can use the text selection related
        '	properties.
        Me.UltraTextEditor1.Focus()

        Me.UltraTextEditor1.Text = "[Selected Text]"

        '	Set the start of the selection to the second character
        Me.UltraTextEditor1.SelectionStart = 1

        '	Set the length of the selection to the value of the TextLength
        '	property minus 2, which will result in all of the text inside the square
        '	brackets being selected
        Me.UltraTextEditor1.SelectionLength = Me.UltraTextEditor1.TextLength - 2

        '	Set the SelectedText property, which will result in the currently
        '	selected text being replaced with the value of the SelectedText
        '	property.
        Me.UltraTextEditor1.SelectedText = "Changed"

        '	Set the SelectionLength property to 0, which will result
        '	in all of the text becoming deselected.
        Me.UltraTextEditor1.SelectionLength = 0

        '   Set the ReadOnly property to true so the text cannot be changed
        Me.UltraTextEditor1.ReadOnly = True
    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;

		private void button1_Click(object sender, System.EventArgs e)
		{
			//	Set focus to the control so we can use the text selection related
			//	properties.
			this.ultraTextEditor1.Focus();

			this.ultraTextEditor1.Text = "[Selected Text]";

			//	Set the start of the selection to the second character
			this.ultraTextEditor1.SelectionStart = 1;

			//	Set the length of the selection to the value of the TextLength
			//	property minus 2, which will result in all of the text inside the square
			//	brackets being selected
			this.ultraTextEditor1.SelectionLength = this.ultraTextEditor1.TextLength - 2;

			//	Set the SelectedText property, which will result in the currently
			//	selected text being replaced with the value of the SelectedText
			//	property.
			this.ultraTextEditor1.SelectedText = "Changed";

			//	Set the SelectionLength property to 0, which will result
			//	in all of the text becoming deselected.
			this.ultraTextEditor1.SelectionLength = 0;

			//   Set the ReadOnly property to true so the text cannot be changed
			this.UltraTextEditor1.ReadOnly = true;

		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also