Table of Contents

Property MaxLength

Namespace
Alternet.Editor.TextSource
Assembly
Alternet.Editor.v9.dll

MaxLength

Specifies the maximum number of characters that can be entered into the edit control.

public virtual int MaxLength { get; set; }

Property Value

int

Examples

Here is how to use a MaxLength in the C# code:

using System.Windows.Forms;

using Alternet.Editor;
using Alternet.Editor.TextSource;

public partial class Form1 : Form
{
    private TextSource textSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit = new SyntaxEdit(this.components);
        textSource = new TextSource(this.components);
        textSource.LoadFile("myfile.txt");

        textSource.MaxLength = 100;
        syntaxEdit.Source = this.textSource;
    }
}

Here is how to use a MaxLength in the Visual Basic code:

Imports System.Windows.Forms
Imports Alternet.Editor
Imports Alternet.Editor.TextSource

Partial Public Class Form1
    Inherits Form

    Private textSource As TextSource

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit = New SyntaxEdit(Me.components)
        textSource = New TextSource(Me.components)
        textSource.LoadFile("myfile.txt")
        textSource.MaxLength = 100
        syntaxEdit.Source = Me.textSource
    End Sub
End Class

Remarks

Set MaxLength property to limit the maximum length of the text stored by TextSource object.

Setting this property limits how many characters the user can enter in the SyntaxEdit control linked to this TextSource object.