Table of Contents

Property AutoCorrection

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

AutoCorrection

Gets or sets a boolean value indicating whether to auto correct words being typed.

public virtual bool AutoCorrection { get; set; }

Property Value

bool

Examples

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

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit1 = new Alternet.Editor.SyntaxEdit(this.components);
        syntaxEdit1.Source.CheckSpelling = true;
        syntaxEdit1.AutoCorrection = true;
        syntaxEdit1.AutoCorrectDelimiters = (Alternet.Editor.EditConsts.DefaultAutoCorrectDelimiters + "'").ToCharArray();
        syntaxEdit1.AutoCorrect += SyntaxEdit1_AutoCorrect;
    }

    private void SyntaxEdit1_AutoCorrect(object sender, Alternet.Editor.AutoCorrectEventArgs e)
    {
        switch (e.Word)
        {
            case "String":
                e.CorrectWord = "string";
                e.HasCorrection = true;
                break;
        }
    }
}

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

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit1 = New Alternet.Editor.SyntaxEdit(Me.components)
        syntaxEdit1.Source.CheckSpelling = True
        syntaxEdit1.AutoCorrection = True
        syntaxEdit1.AutoCorrectDelimiters = (Alternet.Editor.EditConsts.DefaultAutoCorrectDelimiters & "'").ToCharArray()
        AddHandler syntaxEdit1.AutoCorrect, New Alternet.Editor.AutoCorrectEvent(AddressOf Me.SyntaxEdit1_AutoCorrect)
    End Sub

    Private Sub SyntaxEdit1_AutoCorrect(ByVal sender As Object, ByVal e As Alternet.Editor.AutoCorrectEventArgs)
        Select Case e.Word
            Case "String"
                e.CorrectWord = "string"
                e.HasCorrection = True
        End Select
    End Sub
End Class

Remarks

SyntaxEdit control can be configured to automatically correct misspelled words as the user types by setting AutoCorrection property and handling AutoCorrect event to provide correct word spelling.