SelectionStart and SelectionColor in RadRichTextEditor

2 posts, 0 answers
  1. joshua
    joshua avatar
    1 posts
    Member since:
    Nov 2015

    Posted 20 Nov 2015 Link to this post


    I am new in here. I hope someone will help me.I'm writing this peace of code to check if the inputted text are correct and change the color my text if it is wrong

    My error is on SelectionStart and SelectionColor

    Please see below my code

    Private Sub RadRichTextEditor1_TextChanged(sender As Object, e As EventArgs) Handles RadRichTextEditor1.TextChanged
           Dim ValuetoCheck= RadRichTextEditor2.Text
           Dim ArrayValue() As String = W.Split(" ")
             For Each searchword As String In ValuetoCheck
               Dim index As Integer = 0
               While index <> -1
                   index = RadRichTextEditor1.Text.IndexOf(searchword, index)
                   If index <> -1 Then
                       If index = RadRichTextEditor1.Text.Length - searchword.Length - 1 Then
                           RadRichTextEditor1.SelectionStart = index
                           RichTRadRichTextEditor1extBox1.SelectionLength = searchword.Length
                           RadRichTextEditor1.SelectionColor = Color.Black
                           RadRichTextEditor1.SelectionStart = RadRichTextEditor1.Text.Length
                           Exit Sub
                           index += 1
                       End If
                       RadRichTextEditor1.SelectionStart = n
                       RadRichTextEditor1.SelectionColor = Color.Red
                   End If
               End While
           Next ' added
       End Sub

  2. Dimitar
    Dimitar avatar
    1337 posts

    Posted 24 Nov 2015 Link to this post

    Hi  Joshua,

    Thank you for writing.

    The RadRichTextEditor does not work like a regular textbox. So its Text property is only inherited and should not be used. To retrieve the text you can use one of the format providers. Detailed information about how this control works is available in the following articles:
    In addition, the control supports spell checking out of the box: Spellcheck.

    Let me know if you have additional questions.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top