Invalid Filename Check
I have a string that stores a filename and is used in a SaveFileDialog. I
need to ensure that the filename is valid (e.g., contains no slashes)
before I assign it to the FileName property of the SaveFileDialog. My
question is: Is there a quick way to ensure that the filename is valid
before assigning it?
Example:
string fileName = fileNameTextBox.Text;
//Some code here to check validity of fileName
if(fileNameIsValid)
{
saveFileDialog.FileName = fileName;
}
No comments:
Post a Comment