473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Set NewLine styles -- CRLF and LF?

StreamWriter sw = new StreamWriter(strFileName, false,
encoding);
sw.NewLine = "\r\n";
sw.Write(txtbox.Text);
sw.Close();

In the code snippet above, I tried to save the content of
a RichTextBox as a plain text file; however, the result
file would have "\n" as its line terminators instead of
Windows default "\r\n". (Window Notepad would show the
lines with a square in between.)

I even tried to set the StreamWriter.NewLine property, but
it still did not work. What's the proper way to set
NewLine option? Thanks.
Nov 15 '05 #1
0 5774

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PagCal | last post by:
If I want to write client independant code, and generate new lines for WINDOWS as well as UNIX, how can I tell from a php scrip what to use? Should it be '\n' or '\r\n' or '\r' ? The unix...
3
by: Leeds, Mark | last post by:
I did more investigation into my previous problem and what happens is that my text file has \r for representing a new line instead of a \n. is there a way to tell the readlines function that the...
4
by: McKirahan | last post by:
How would I use a regular expression to remove all trailing Carriage Returns and Line Feeds (%0D%0A) from a textarea's value? Thanks in advance. Also, are they any great references for learning...
6
by: The Plankmeister | last post by:
Hi.. I'm trying to achieve a newline effect within a <dt> block, but am having problems. Here is the basic code: <dl> <dt> <a href="admin_menu.html" class="small">Click here to modify the
3
by: JJ | last post by:
Hi, I was wondering what is the constant for newline so that I can add newlines in messageBoxs ? Vb has vbcCrLf what is it for C#? Thanks, JJ
29
by: runningdog | last post by:
Hi, I would like to be able to embed a newline in a text string. Is there any convienent notation to do this TIA Steve
8
by: Jm | last post by:
Hi all Is there a way to search a string and count the amount of newline or crlf's that are inside it ? Under vb6 i could search for vbcrlf using Instr and a loop. Is there a similar method...
11
by: rossum | last post by:
I want to declare a const multi-line string inside a method, and I am having some problems using Environment.NewLine. I started out with: class foo { public void PrintStuff() { const...
6
by: versus | last post by:
Hi I have a table column that has multiple lines (\r\n) and html tags in it. I want to display it in a div and label that html tags can be seen and newlines should work. If i use div.innerHTML...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.