Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

WriteAllText, ReadAllText and Replace

$
0
0

I'm trying to replace text in a rtf file with:

System.IO.File.WriteAllText(sTarget, System.IO.File.ReadAllText(sTarget).Replace("||MyCompanyData||", MyCoText))

For some reason, it won't work.  I'm doing the same thing a few lines above that with this:

System.IO.File.WriteAllText(sTarget, System.IO.File.ReadAllText(sTarget).Replace("||ProjectOverview||", txtProjectOverview.Text))

That one works fine and without fail.  I even tried to replace MyCoText with txtProjectOverview.Text just to see if it was something with the string variable but it still doesn't work.

It seems so easy but I still don't see what I'm doing wrong.


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>