title: How to replace a substring in VB.NET?
body: <p>I have a question involving the string <code>Replace</code> function in Visual Basic .NET:</p>
  
  <p>I have a Visual Basic script for my project. I have a <code>RichTextBox</code> named <code>sample</code></p>
  
  <pre><code>Dim string1 as string = "text to find"
  Dim string2 as string = "text to replace find with"
  Dim mediacurrent as string
  
  mediacurrent = sample.text
  
  mediacurrent.replace(string1, string2)
  
  sample.text = mediacurrent
  </code></pre>
  
  <p>The above script returns a blank text box. Note the text box is rich and contains non-formatted but multiline text. What am I doing wrong?</p>