Solved

newline in a string

Posted on 2007-12-06
8
909 Views
Last Modified: 2008-02-01
In C#, I forget how you invoke a NewLine in the middle of a string -- so that the string after the newline appears on a -- uh -- new line.
0
Comment
Question by:knowlton
  • 5
  • 3
8 Comments
 
LVL 22

Accepted Solution

by:
RedKelvin earned 500 total points
ID: 20424523
Hi, use

\n
0
 
LVL 5

Author Comment

by:knowlton
ID: 20424527
or:

Environment.NewLine
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20424528
Oh, and there is this too

System.Environment.NewLine;

Open in new window

0
 
LVL 5

Author Comment

by:knowlton
ID: 20424530
LOL ...  yep!
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 22

Expert Comment

by:RedKelvin
ID: 20424536
snap!

yeah, try this
string str = "this is a" + System.Environment.NewLine + "multi line string";

Open in new window

0
 
LVL 5

Author Comment

by:knowlton
ID: 20424558
Huh.......the newline is not "showing up" in the string.

The string is being assigned to an asp:Label at runtime

What gives?
0
 
LVL 5

Author Comment

by:knowlton
ID: 20424589
Huh.

These seem to work:

<br>

I guess I didn't think that would work in the middle of a string that is going into a Label.Text property.
0
 
LVL 5

Author Comment

by:knowlton
ID: 20424595
"This sentence will have a" + "<br><br>" + " line break in it"

produces:

This sentence will have a

line break in it
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now