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




Reply With Quote