title: Replace text in textbox without using replace function
body: <p>This is more like a logical question, I just need an idea on how to best approach this problem.</p>
  
  <p>I am trying to do this in visual basic. I have to text box, in text box 1, I would have some text and if it contains certain word, I want to replace that with something else and have the new output in text box 2, after clicking on a convert button.</p>
  
  <p>I know this can be done really easily with the replace function built in, but I am trying to do it without the replace function.</p>
  
  <p>For example: </p>
  
  <blockquote>
    <p>I want to replace "fox" with "dog"</p>
    
    <p>Textbox 1: The quick brown fox jumped over the lazy dog.</p>
    
    <p>Textbox 2: The quick brown dog jumped over the lazy dog.</p>
  </blockquote>
  
  <p>I got it to work with the code below, but this only works for the first instance. How can I change my code for all instances.</p>
  
  <pre><code>String from InputText
      Dim S1 As String
      S1 = InputText.Text
  
      'Position of start of "Edge Computer"
      Dim pStart As Integer
      pStart = S1.IndexOf("Edge Computer")
  
      'Position of end of "Edge Computer"
      Dim pEnd As Integer
      pEnd = S1.IndexOf("r", pStart) + 1
  
      'Actual old name as string
      Dim strOld As String
      strOld = S1.Substring(pStart, 13)
  
      'New String for Output
      Dim S2 As String
      S2 = S1.Substring(0, pStart) &amp; "3dg3" &amp;      S1.Substring(pEnd)
  
      OutputText.Text = S2
  </code></pre>
  
  <p>Thanks</p>