.Replace(String,String) VB function not works
<p>I need to replace the end of a pathfile in VB. So I try this code : </p>

<pre><code>Private Function getfiledata(ByVal fichier As String) As String
  Dim fileReader As String
  Dim FichierFinal As String
  MsgBox(fichier)
  FichierFinal = fichier.Replace("E002.pfx","_E002.pem")
  FichierFinal = fichier.Replace("X002.pfx","_X002.pem")
  FichierFinal = fichier.Replace("A005.pfx","_A005.pem")
  MsgBox(FichierFinal)
  fileReader = My.Computer.FileSystem.ReadAllText(FichierFinal)
  Return fileReader
End Function
</code></pre>

<p>The first MsgBox function return me the following result : </p>

<blockquote>
  <p>C:/Users/Bruno/Documents/Visual Studio
  2010/Projects/SerEbics/SerEbics/bin/Debug/Certificats/512250X002.pfx</p>
</blockquote>

<p>But the second return me the same path : </p>

<blockquote>
  <p>C:/Users/Bruno/Documents/Visual Studio2010/Projects/SerEbics/SerEbics/bin/Debug/Certificats/512250X002.pfx</p>
</blockquote>

<p>So I need this result : </p>

<blockquote>
  <p>C:/Users/Bruno/Documents/Visual Studio2010/Projects/SerEbics/SerEbics/bin/Debug/Certificats/512250_X002.pem</p>
</blockquote>

<p>Thank you in advance ! </p>

<p>Thomas</p>