I have a textarea containing endofline delimited text, and I would like to color certain words. The coloring process goes pretty quick untill the text contains one thousand lines, but it takes too long (even 8 seconds) when there are several thousand lines. Each line has a min of 4 words and a max of 20 words.
The code I’m using is shown below. I tried using a memoryblock but I’m not sure if I used it correctly: after initializing it (now it is commented), I replaced the only instance of “source” with “m”; but as I said, I dont know if that is the right procedure. I say this, because uncommenting the memoryblock line, some part of the text gets colored in the wrong place.
Anyway, is there any better way to accomplish what I’m trying to do? Thanks.
Protected Sub setContextClr()
dim start,i as Integer
TextArea1.selTextColor = kclrBlack
dim source as String = TextArea1.text
//dim m as MemoryBlock = source
start = 1
dim s as String = findField.text
if s <> “” then
dim substrLength as integer = Len(s)
start= instr(start,source, s)
If start < 1 then
TextArea1.SelStart = start-1 TextArea1.SelLength = substrLength TextArea1.SelTextColor = findClr TextArea1.SelLength = 0 start = start + substrLength Loop