title: Find all instances of a word in a string and display them in textbox (vb.net)
body: <p>I have a string filled with the contents of a textbox (pretty large).</p>
  <p>I want to search through it and display all occurances of this word. In addition I need the searchresult to display some charachters in the string before and after the actual searchterm to get the context for the word.</p>
  <p>The code below is part of a code that takes keywords from a listbox one by one using For Each.  The code displays the first occurance of a word together with the characters in front and after the word - and stop there. It will also display &quot;no Match for: searched word&quot; if not found.</p>
  <p>As stated in the subject of this question - I need it to search the whole string and display all matches for a particular word together with the surrounding characters.</p>
  <pre class="lang-vb prettyprint-override"><code>Where = InStr(txtScrape.Text, Search)
  
  If Where &lt;&gt; 0 Then
      txtScrape.Focus()
      txtScrape.SelectionStart = Where - 10
      txtScrape.SelectionLength = Where + 50
      Result = txtScrape.SelectedText
      AllResults = AllResults + Result
  
  Else
      AllResults = AllResults + &quot;No Match for: &quot; &amp; item
  End If
  </code></pre>