So if one tries to display that resource string in, say, message box, the 2 characters "\n" will be displayed instead of new line which one expects.
For example, let's say ErrorMsg in Resource1.resx has some error message like "Error : invalid data.\n{0}."
msg = string.Format(Resource1.ErrorMsg, errInfo); MessageBox.Show(this, msg, "Error");
The code above will display something like "Error : invalid data.\nwrong chars found" in one line.
To add new line between two sentence, double backslash should be replaced by single backslash or Environment.NewLine.
msg = string.Format(Resource1.ErrorMsg, errInfo); msg = msg.Replace("\\n", Environment.NewLine); MessageBox.Show(this, msg, "Error");
No comments:
Post a Comment