This is a migrated thread and some comments may be shown as answers.

Caret positioning in richtexteditor

4 Answers 106 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Mattiullah
Top achievements
Rank 1
Mattiullah asked on 11 Mar 2016, 11:16 AM

i need some help in    radRichTextEditor1_Keydown

        If e.keycode= keys.right Then

then caret goes back two letter

and

        ElseIf   e.keycode= keys.left  Then
then caret goes forward two letter

        End If

4 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 11 Mar 2016, 04:15 PM
Hello Mattiullah,

Thank you for writing.

RadRichTextEditor exposes API for positioning within the document. Detailed information is available here: Positioning.

The described behavior can be accomplished by handling the KeyDown event of the editor this way:
private void radRichTextEditor1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Right)
    {
        DocumentPosition position = this.radRichTextEditor1.Document.CaretPosition;
        position.MoveToNext();
    }
    else if (e.KeyCode == Keys.Left)
    {
        DocumentPosition position = this.radRichTextEditor1.Document.CaretPosition;
        position.MoveToPrevious();
    }
}

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Mattiullah
Top achievements
Rank 1
answered on 11 Mar 2016, 04:59 PM

it shows an error

 

SeverityCodeDescriptionProjectFileLine
ErrorBC30002Type 'DocumentPosition' is not defined.UrduC:\Users\PakDev.DESKTOP-E32MNMH\Documents\Visual Studio 2015\Projects\Urdu\Urdu\MainForm.vb32

0
Mattiullah
Top achievements
Rank 1
answered on 11 Mar 2016, 05:15 PM
thanks
0
Hristo
Telerik team
answered on 14 Mar 2016, 07:34 AM
Hello Mattiullah,

I am glad I managed to help.

Please let me know if you need further assistance.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextEditor
Asked by
Mattiullah
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Mattiullah
Top achievements
Rank 1
Share this question
or