Short question: I have a string in my resources: "This is my test string {0}\n\nTest"
I'm trying to display this string in my Messagebox:
MessageBox.Show(String.Format(Properties.Resources.About,
Constants.VERSION),
Properties.Resources.About_Title, MessageBoxButton.OK,
MessageBoxImage.Information);
However I don't get new lines. The \n still show up as characters, not as new lines.
I also tried to use a workaround like mystring.Replace("\n", Environment.NewLine) but this also doesn't change anything.
What am I doing wrong?
Edit: Funny thing to mention: Replace("\n", "somethingelse") doesn't change anything.
Edit2: Shift+Enter in my Resource-File instead of \n seems to work... Strange behaviour anyway
Replace("\n", "somethingelse") doesn't change anything
comment, that is because you should be looking for\\n
instead of just\n
. What you think is a new line reference is more than likely being escaped by the time you try to replace it. If you have a situation where you pull text from a DB and spit it out to a MessageBox then try to useMessageBox.Show(_settings.ContactInfo.Replace("\\n","\n"));
. – Suffer