By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,667 Members | 1,678 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,667 IT Pros & Developers. It's quick & easy.

Problem registry value is read as verbatim

P: n/a
Hello,

Is there a way to read values from the registry as regular instead of
verbatim?

Regards,
Fred
Nov 16 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Is there a way to read values from the registry as regular instead of
verbatim?


What do you mean by regular and verbatim in this context?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2

P: n/a

"Mattias Sjögren" <ma********************@mvps.org> schreef in bericht
news:Or**************@TK2MSFTNGP09.phx.gbl...
Is there a way to read values from the registry as regular instead of
verbatim?


What do you mean by regular and verbatim in this context?


Hi Mattias,

When I read a string value from the registry then the string is formatted
with @ in the begin. I want to read it regular so that I can use the \r and
etc in the string for text formatting.

Regards,
Fred
Nov 16 '05 #3

P: n/a
Fred <fred@invalid> wrote:
When I read a string value from the registry then the string is formatted
with @ in the begin. I want to read it regular so that I can use the \r and
etc in the string for text formatting.


You're being confused by the debugger.

See http://www.pobox.com/~skeet/csharp/s....html#debugger

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

P: n/a

"Jon Skeet [C# MVP]" <sk***@pobox.com> schreef in bericht
news:MP************************@msnews.microsoft.c om...
Fred <fred@invalid> wrote:
When I read a string value from the registry then the string is formatted
with @ in the begin. I want to read it regular so that I can use the \r
and
etc in the string for text formatting.


You're being confused by the debugger.


Hi Jon,

Compiled as release same "problem", when I add a \r or whatever to the
string in the register and write it to a textbox for testing the \r is
displayed as \r instead of a return. Is there another solution for this?

Regards,
Fred
Nov 16 '05 #5

P: n/a
Fred <fred@invalid> wrote:
Compiled as release same "problem", when I add a \r or whatever to the
string in the register and write it to a textbox for testing the \r is
displayed as \r instead of a return. Is there another solution for this?


If it's \r in the textbox itself, then that's in the registry. You can
replace all occurrences of "\r" with CR, but you need to know for
certain what you really expect in the registry.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6

P: n/a

"Jon Skeet [C# MVP]" <sk***@pobox.com> schreef in bericht
news:MP************************@msnews.microsoft.c om...
Fred <fred@invalid> wrote:
Compiled as release same "problem", when I add a \r or whatever to the
string in the register and write it to a textbox for testing the \r is
displayed as \r instead of a return. Is there another solution for this?


If it's \r in the textbox itself, then that's in the registry. You can
replace all occurrences of "\r" with CR, but you need to know for
certain what you really expect in the registry.


Hi Jon

What I want is that a string stored in the registry something like this
'Thank you \r\n second line' read out of the registry and use that in a
e-mail. When I remove the @ in debug mode or create the string in the
program then it works. Only when a read the string from the registry it is
not formatted like the way I want.

Regards,
Fred
Nov 16 '05 #7

P: n/a

The problem is that when you put "Thank you \r\n second line" in C#
source code the compiler replaces the \r and \n with appropriate
characters in the compiled code. That does not happen at run-time.
To gain this behavior at you'll need to do a replace on the string to
replace the escape characters you want to support with their actual
values.

Best regards,

Sam
On Wed, 9 Mar 2005 11:55:49 +0100, "Fred" <fred@invalid> wrote:

"Jon Skeet [C# MVP]" <sk***@pobox.com> schreef in bericht
news:MP************************@msnews.microsoft. com...
Fred <fred@invalid> wrote:
Compiled as release same "problem", when I add a \r or whatever to the
string in the register and write it to a textbox for testing the \r is
displayed as \r instead of a return. Is there another solution for this?


If it's \r in the textbox itself, then that's in the registry. You can
replace all occurrences of "\r" with CR, but you need to know for
certain what you really expect in the registry.


Hi Jon

What I want is that a string stored in the registry something like this
'Thank you \r\n second line' read out of the registry and use that in a
e-mail. When I remove the @ in debug mode or create the string in the
program then it works. Only when a read the string from the registry it is
not formatted like the way I want.

Regards,
Fred


B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
Nov 16 '05 #8

P: n/a
Fred <fred@invalid> wrote:
What I want is that a string stored in the registry something like this
'Thank you \r\n second line' read out of the registry and use that in a
e-mail. When I remove the @ in debug mode or create the string in the
program then it works. Only when a read the string from the registry it is
not formatted like the way I want.


I suggest you read the whole of the page I linked to before, and
understand what the @ is actually doing when it's in source code, and
what the difference is between a string literal in source code and the
string itself.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.