Results 1 to 3 of 3

Thread: need a loop for Highlighting more word then one

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member goofan's Avatar
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    296

    Exclamation 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
    Last edited by goofan; Nov 18th, 2009 at 04:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width