At the moment I'm working on a simple syntax highlighter and I have couple of problems. Could you help me out?
I have a class library with a component class in it. Everything is in VB.NET. It's only one file so you can see it here https://gist.github.com/2366507 . On line 92, there is the OnTextChanged Sub. I was thinking about adding ProcessAllLines() (as on line 128) to the end of that Sub, and it worked. However when I was typing in code to the RichTextBox (source which I used is here https://gist.github.com/2366526) after each text change it was checking and processing ALL the lines. So I deleted ProcessAllLines() in the OnTextChanged Sub.
I'm thinking about running ProcessAllLines() when the user pastes something to the SyntaksRichTextBox. However I do not know how to do that. I know that it should be something like:
I also want it to be in the class library, not the application (Syntaks Demo). Could you help me out here? Thanks.
Rafal Chmiel, @RafalChmiel
asked Apr 12 '12 at 07:15
for this type of thing an if statement is not going to work, if i understand the problem...
What you need is an event, try this:
An if statement will execute subsequently, this will work as an interrupt.
Can I be a real pain and point out that there are several ways to paste text that do not require the keyboard at all and therefore you need another solution anyway? It seems to me that if you're using a single textbox as both input and display there really isn't any choice but to process all lines continually. What you need is some way of separating the lines so that colouring takes place only at the completion of each line and only for that line and a textbox is not designed with that purpose in mind.
answered Apr 13 '12 at 12:24