Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New line in textbox
Message
From
08/07/2005 10:10:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/07/2005 10:03:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01030410
Message ID:
01030432
Views:
17
>>\n is still valid for console apps. Use Environment.NewLine so it would be portable (winforms,webforms).
>>
>>
>>TxtResult.Text = "Line 1" + Environment.NewLine + "Line2";
>>
>>This alternative (similar to text...endtext) is also valid:
>>
>>TxtResult.Text = @"Line 1
>>Line2";
>>
Cetin
>
>Thanks. I suppose the "@" sign makes the compiler treat the remaining text just as it is typed?

Yes, but not exactly.ie: To put doublequotes in you need to have double doublequotes < bg >
From "C# programmers reference" as is:
String literals are of type string and can be written in two forms, quoted and @-quoted. Quoted string literals are enclosed in double quotation marks ("):

"good morning"  // a string literal
and can contain any character literal, including escape sequences:

string a = "\\\u0066\n";  // backslash, letter f, new line
Note   The escape code \udddd (where dddd is a four-digit number) represents the Unicode character U+dddd. Eight-digit Unicode escape codes are also recognized: \udddd\udddd.
@-quoted string literals start with @ and are enclosed in double quotation marks. For example:

@"good morning"  // a string literal
The advantage of @-quoting is that escape sequences are not processed, which makes it easy to write, for example, a fully qualified file name:

@"c:\Docs\Source\a.txt"  // rather than "c:\\Docs\\Source\\a.txt"
To include a double quotation mark in an @-quoted string, double it:

@"""Ahoy!"" cried the captain." // "Ahoy!" cried the captain.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform