2

ow to write new line character \n in resx file (e.g MyFile.resx)?

Example: I have resx file with property MyMessage = "One line\nNextLine"

When I used: MessageBox.Show(MyFile.MyMessage) I had a message in one line (without Enter).

Shift + Enter in the resource editor doesn`t work.

Oli Weirdo
  • 107
  • 1
  • 8

1 Answers1

5

If you open the .resx file with the Managed Resources Editor you can press ShiftEnter to enter multi line messages:

Multiline text in resource editor

If you open the .resx file with a text editor the corresponding entry looks like this:

  <data name="MultiLineMessage" xml:space="preserve">
    <value>Test
Message</value>
  </data>

enter image description here

And calling it with

MessageBox.Show(Properties.Resources.MultiLineMessage);

return this box:

Messagebox with multiline message

So, everything seems to work as expected. So please re-check if you really have a multi line message in your resource file.

Oliver
  • 43,366
  • 8
  • 94
  • 151