Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Syntax Highlighting?
#1
Hey guys. Here's a question for ya guys...
Code:
Dim listbox1 As New ListBox
    listbox1.Items.Add("<br/>")
    Dim int As Integer = 0
    Dim line As String = RichTextBox1.GetLineFromCharIndex(RichTextBox1.SelectionStart)
    For Each item In listbox1.Items
      If RichTextBox1.Lines(line).Contains(item) Then
        Dim instance As Integer = RichTextBox1.Find(item, RichTextBox1.SelectionStart - CInt(item.ToString.Length), RichTextBox1.SelectionStart)
        If instance > 0 Then
          RichTextBox1.SelectionStart = RichTextBox1.SelectionStart - CInt(item.ToString.Length)
          RichTextBox1.SelectionLength = item.ToString.Length
          RichTextBox1.SelectionColor = Color.Blue
        End If
      End If

    Next
    RichTextBox1.SelectionStart = ss
    RichTextBox1.SelectionLength = sl
    RichTextBox1.SelectionColor = Color.Black
My coding selects an item from the list box and tries to color the words in the currently selected line, however, it often colors characters that come after the instance. Why is this happening?
My Blog | My Setup | My Videos | Have a wonderful day.
#2
i think it would be better if we could have the project file <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->
Website: <!-- m --><a class="postlink" href="http://www.PBAProductions.com">http://www.PBAProductions.com</a><!-- m -->
E-Mail: <!-- e --><a href="mailtoTongueatrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
[Image: 2hnx8av.jpg]
#3
Haha, alright. This should do it then,
[attachment=0]<!-- ia0 -->HTML-IDEx.zip<!-- ia0 -->[/attachment]


Attached Files
.zip   HTML-IDEx.zip (Size: 628.47 KB / Downloads: 582)
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  I am getting problem with brandonio's registration form... mnxford 1 9,175 03-27-2013, 10:55 AM
Last Post: mnxford
  i am getting a problem with brandonio's login form mnxford 1 9,107 03-27-2013, 10:55 AM
Last Post: mnxford
  Syntax Highlighting.. Fuzzy168 3 13,272 06-18-2012, 06:28 PM
Last Post: Fuzzy168

Forum Jump:


Users browsing this thread: 1 Guest(s)