probleum in searching a word multiple time in a single file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veer
    New Member
    • Jul 2007
    • 198

    probleum in searching a word multiple time in a single file

    Hi
    i made program on searching and if a word is present in a file more than one time this program search it one time and exit the file but i want to show all the locations of the searched word in single file
    for single search i use the coding
    Dim contents As String = objStreamReader .ReadToEnd()
    txtfile.text=co ntents
    txtfile.Selecti onStart = InStr(txtfile.T ext, "apend")
    s = contents.Substr ing(txtfile.Sel ectionStart - 1, 10)

    how i can modify the above program so that it search the word on all locations

    thanks in advance
    varinder
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Use the correct function of strings .indexOf() and give it a start index that is a value AFTER the previous index.

    Comment

    Working...