Why do none of these seem to work?
String.Replace("/", "_");
String.Replace("//", "_");
String.Replace(((char)47).ToString(), "_");
The string named "FileName" still says "MyFile 06/06/09"
Why do none of these seem to work?
String.Replace("/", "_");
String.Replace("//", "_");
String.Replace(((char)47).ToString(), "_");
The string named "FileName" still says "MyFile 06/06/09"
Are you assigning the FileName.Replace to something? It returns the new FileName, it doesn't actually change it.
string fileName = FileName.Replace("//", "");
You probably want to do this:
FileName = FileName.Replace("//", "")...
Filename = FileName.Replace("//", "");
Filename = FileName.Replace("/", "");
Filename = FileName.Replace(((char)47).ToString(), "_");
If that is your actual code then you need to actually assign it back to the value as in...
FileName = FileName.Replace("//", "");
FileName = FileName.Replace("/", "");
FileName = FileName.Replace(((char)47).ToString(), "_");
One more thing I'll add is to check your quote characters...if you paste from Word then you'll end up with the wrong characters. Of course, you'll get a compile-time error if that's the case...