title: How does the string replace function in VB.net not work?
body: <p>I wrote up some code. The code is shown below. The first part is to read a html into string format. The second part is to search a mark in the string and replace the string by other string.</p>
  
  <p>The 1st part (I test it many times, it works fine)</p>
  
  <pre><code>Public Function ReadTextFile(ByVal TextFileName As String) As String
      Dim TempString As String
      Dim StreamToDisplay As StreamReader
      StreamToDisplay = New StreamReader(TextFileName)
      TempString = StreamToDisplay.ReadToEnd
      StreamToDisplay.Close()
      Return TempString
  End Function
  </code></pre>
  
  <p>The 2nd part (I test it many times, the search and replace does not work. I checked many times that the "TempText" DOES contain string. The "the_key_string" DOES inside the "TempText" String. I check it by using QuickWatch in VB.net. However, the replace function does NOT do its job)</p>
  
  <pre><code>            Dim TextPath = C:xxxxxx
              TempText = ReadTextFile(TextPath)
              TempText.Replace("the_key_string", "replace_by_this_string")
  </code></pre>
  
  <p>Please help. I have no clue where I made the mistake</p>