Hello Michael,
ahh, damn, almost forgot, it's old trick.
when u read from the resources, you lost your escape sequece. u need to restore
it. changing \\r on \r
the following code fix it
string str = Properties.Resources.MsgHelloWorld;
str = str.Replace("\\n", "\n");
str = str.Replace("\\r", "\r");
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
MN> Hello Peter,
MN>
MN> hmmmmm, interesting.
MN> seems that smth wrong with the text encoding. need to investigate
MN> ---
MN> WBR,
MN> Michael Nemtsev [.NET/C# MVP] :: blog:
MN>
http://spaces.live.com/laflour
MN> "The greatest danger for most of us is not that our aim is too high
MN> and we miss it, but that it is too low and we reach it" (c)
MN> Michelangelo
MN>
>>> Why not just read it into the string
>>> Properties.Resources.<your_resource> and then add the new lines ?
PH>> Hmm, I'm not sure I follow...
PH>>
PH>> I have a resource file with the following tag and text:
PH>> MsgHelloWorld "Hello\r\nWorld"
PH>>
PH>> I then retrieve the resource with a resource manager like this:
PH>> resMan = new ResourceManager( ... )
PH>> string msg = resMan.GetString("MsgHelloWorld");
PH>> MessageBox.Show(msg);
PH>> This will print "Hello\r\nWorld", but I want it to print:
PH>> "Hello
PH>> World"
PH>> How did you mean I could solve this?
PH>> / Peter
PH>>
>>> PH> I understand that the\n and \r only means something to the C#
>>> PH> compiler so when retrieving a line like "Hello\r\nWorld" from a
>>> PH> resource file (localized form or self made resource file), it
>>> prints
>>> PH> the text as just like it was written.
>>> PH> PH> Is there any easy way to introduce a newline (tab etc.) into
>>> a
>>> PH> string retrieved from a resource file? Or should I create a
>>> resource
>>> PH> string for each line?
>>> PH> PH> Thanks,
>>> PH> PH> Peter
>>> PH