need a loop for Highlighting more word then one
Hi i got this program that searches throught files for a word or more words then 1. and all the files desplayes in a listbox (list1) and when i press on any of the "files" in the listbox i get the content in another window textbox...
right now i can highlight the last "looped" word but i wanna highlight all the found words in the content...
plz help me if u can.
code:
Code:
Private Sub lbdraw_click()
dim numberoffile as stringdim varde as string
dim impa as string
dim content as string
dim myfilenum as string
searchfor = (text1.text)
words() = split(searchfor)
dim i as integer
dim tempstr as string
For i = 0 To Ubound(words)
tempstr = replace(words(i), ",", "")
tempstr = replace(tempstr, ";", "")
e.t.c.
Next i
List1.text = ""
numberOfFile = lbdraw.ListIndex
varde = filearray(numberOfFile)
myfilenum = FreeFile()
open varde For Input As #myfilenum
Do While Not EOF(myfilenum)
line input #myfilenum, impa
impa = impa &vbNewLine
content = content + impa
Loop
List1.text = content
Close #myfilenum
Dim talTest as integer
talTest = 0
talTest = instr(content, Tempstr)
List1.setfocus
If talTest <> 0 Then
List1.selstart = talTest - 1
List.selLength = Len(tempstr)
Else
List1.selstart = talTest
List.selLength = Len(tempstr)
End If
End Sub
Re: need a loop for Highlighting more word then one
you can not select more than 1 selection in a textbox
change your textbox for a richtextbox, you can then use highlighting (not selecting), to highlight multiple ranges
there is a thread by moeur in vb6 codebank, for working with richtextbox, including highlighting
Re: need a loop for Highlighting more word then one