Visual Studio line break in resource file

Anyone programming in Visual-Studio is likely to use a resource file to manage texts/strings and output them in several languages, for example for label texts or as a warning message (MessageBox). The text/string can then be written one after the other in the resource editor. But sometimes you need a line break so that the text is structured and clearly displayed, as in the following warning message.

Warning message programmed with Visual Studio and resource file/resource editor, which contains several line breaks
Line breaks of a MessageBox with string from resource file

What does not work

What does not work in this case is if you insert the characters for line feed (\r) and line break (\n), i.e. "\n\r", as with strings. These characters are then displayed in the same way.

What also does not work is that you simply use the key combination “Alt+Enter” or “Alt+Return” as in Excel if you need a line break within a cell.

How it works

In the Visual Studio resource editor cell, however, you can simply use the key combination “Shift+Enter” or “Shift+Return” to insert one or more line breaks.

It will then be displayed in the resource editor as follows

Screenshot of how to insert a line break in text or string in the Visual Studio resource editor
Texts with line breaks in the Visual Studio resource editor

More interesting articles about Visual Studio:

Leave a Reply

Your email address will not be published. Required fields are marked *