In the visual studio settings designer, how can a setting with string 开发者_运维知识库type be set to the newline character? Entering \n
results in the string being set to literally \n
- the escape sequence doesn't seem to have meaning in the setting seditor. So how do I set a setting's value to a non-printable character?
The settings designer edits the App.config (xml) file and the Settings.settings file. I thought about editing the App.config file directly, but entering \n
there again sets the string to literally \n
.
Click the down arrow in the Default value edit box. To get this (note the gray text):
There will be a designer file that goes with your form — either formname.designer.cs
or formname.designer.vb
, depending on which language you use. You'll have to edit this file to include your newline.
This is one of the few cases where I ever recommend touching this file. Most of the time it should be left alone, and your alteration placed in your form's constructor, InitializeComponent() method, or an event line OnLoad or OnActivate.
精彩评论