I'm writing a text editor for my own use ( I'm "home learning") where I want to be able to leave comments for myself, like in code section of the VB express IDE. I have figured out how to get the Integer Location of the apostrophy, but can't get it to color the rest of the line. I don't know how to tell the program to find the integer value of the last character in the line. I need that to be able to subtract the apostrophy's location from the last character's location, to get the "SelectedLength". Then I can add that to the apstrophy's location to give the SelectedLength the SelectionColor.
This code was thrown together from excerpts of several codes I found on the web. I had to rewrite everything to get it to do what it does so far...
Apostrophy Location is char # 534 , the end of the line is 547. ( I cheated to get that count by placing another apostrophy there, and reclicking the btn. )
Anyway, I want to take 547 - 534 to get (13) the SelectionLength, then give the SelectionColor ( green) to that selected text.
Here is the code that I have been working around to get this:
Dim Location As Integer
Dim char3() As String = {"'"}
Dim z As Integer = CStr(vbCrLf.Count)
For Each symbol As String In char3
Location = rtf1.Find(symbol, RichTextBoxFinds.MatchCase)
Do Until Location < 0
Label7.Text = Location
rtf1.SelectionStart = Location
'rtf1.SelectionLength = (z - Location) <-- Does'nt work
rtf1.SelectionColor = Color.Green
Location = rtf1.Find(symbol, Location + 1, RichTextBoxFinds.MatchCase)
Loop
Next
I hope this is clear enough for everyone to understand. I have difficulty explaining myself sometimes...