Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
730
Inserting text at the caret position in Ultratexteditor
posted

Hi, 

I want to insert some text in an ultratexteditor at the current caret position when a button is clicked. The problem is that the text is always pasted at the end. Im using ultratexteditor.paste() method. My apologies if this question is discussed before in the forum.

Parents
  • 730
    posted

    Hi,

    I have done following changes to resolve the issue.

    string stringToInsert = "STRING TO INSERT"; 

    ultraTextEditor1.AlwaysInEditMode = true;

    int selectionStart = ultraTextEditor1.Editor.SelectionStart;

    ultraTextEditor1.Text = ultraTextEditor1.Text.Insert(selectionStart, stringToInsert);

    ultraTextEditor1.Editor.SelectionStart = selectionStart + stringToInsert.Length;

     

Reply Children
No Data