473,404 Members | 2,137 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,404 software developers and data experts.

txt1.AppendText appends extra char

Ron
Greetings,

I am writing text to a multi line textbox on a timer as
follows:

txt1.AppendText(@"/* " + DateTime.Now.ToString() + "\n");

Here is what gets displayed

/* 1/1/2004 11:12:11 AM|

There is a pipe | char at the end of the string. I am
guessing it is the "\n" carriage return char. How can I
write text to the multi line textbox with a newline and
without this pipe char?

Thanks,
Ron
Nov 16 '05 #1
5 1807
Ron,

Instead of appending \n, try using Environment.NewLine.

Also, make sure that the Multiline property is set to true on the
textbox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...
Greetings,

I am writing text to a multi line textbox on a timer as
follows:

txt1.AppendText(@"/* " + DateTime.Now.ToString() + "\n");

Here is what gets displayed

/* 1/1/2004 11:12:11 AM|

There is a pipe | char at the end of the string. I am
guessing it is the "\n" carriage return char. How can I
write text to the multi line textbox with a newline and
without this pipe char?

Thanks,
Ron

Nov 16 '05 #2
Ron
Thanks. That did the trick. May I ask this:

Is there a situation where "\n" is preferred over
Environment.NewLine?

If I write data to a delimited text file, does it make any
difference if I end a row of data with "\n" or
Environment.Newline?

The only downside I can see with Environment.Newline is
that it is more chars than "\n".

-----Original Message-----
Ron,

Instead of appending \n, try using Environment.NewLine.
Also, make sure that the Multiline property is set to true on thetextbox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron" <an*******@discussions.microsoft.com> wrote in messagenews:0f****************************@phx.gbl...
Greetings,

I am writing text to a multi line textbox on a timer as
follows:

txt1.AppendText(@"/* " + DateTime.Now.ToString() + "\n");
Here is what gets displayed

/* 1/1/2004 11:12:11 AM|

There is a pipe | char at the end of the string. I am
guessing it is the "\n" carriage return char. How can I
write text to the multi line textbox with a newline and
without this pipe char?

Thanks,
Ron

.

Nov 16 '05 #3
Ron,

Well, I can't think of one. I mean, you might have to write files that
require just the new line character. However, it's pretty common to see the
\r\n combination nowadays.

For your delimited text file, it depends on what is going to process it.
I would think that most modern programming libraries would be able to handle
the \r\n, but you will have to test it to find out.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron" <an*******@discussions.microsoft.com> wrote in message
news:1b****************************@phx.gbl...
Thanks. That did the trick. May I ask this:

Is there a situation where "\n" is preferred over
Environment.NewLine?

If I write data to a delimited text file, does it make any
difference if I end a row of data with "\n" or
Environment.Newline?

The only downside I can see with Environment.Newline is
that it is more chars than "\n".

-----Original Message-----
Ron,

Instead of appending \n, try using

Environment.NewLine.

Also, make sure that the Multiline property is set to

true on the
textbox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron" <an*******@discussions.microsoft.com> wrote in

message
news:0f****************************@phx.gbl...
Greetings,

I am writing text to a multi line textbox on a timer as
follows:

txt1.AppendText(@"/* " + DateTime.Now.ToString() + "\n");
Here is what gets displayed

/* 1/1/2004 11:12:11 AM|

There is a pipe | char at the end of the string. I am
guessing it is the "\n" carriage return char. How can I
write text to the multi line textbox with a newline and
without this pipe char?

Thanks,
Ron

.

Nov 16 '05 #4
Nicholas Paldino [.NET/C# MVP] <mv*@spam.guard.caspershouse.com> wrote:
Well, I can't think of one. I mean, you might have to write files
that require just the new line character. However, it's pretty common
to see the \r\n combination nowadays.


It really depends on the target platform of the file. \n is pretty
standard on Unix, \r\n is pretty standard on Windows.

IIRC, most internet protocols require \r\n.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
Ron
Yes, I am exclusively on Windows systems, so \r\n looks
like it is it..

Thanks all for your help.

It really depends on the target platform of the file. \n
is pretty
standard on Unix, \r\n is pretty standard on Windows.

IIRC, most internet protocols require \r\n.
<<

-----Original Message-----
Ron,

Well, I can't think of one. I mean, you might have to write files thatrequire just the new line character. However, it's pretty common to see the\r\n combination nowadays.

For your delimited text file, it depends on what is going to process it.I would think that most modern programming libraries would be able to handlethe \r\n, but you will have to test it to find out.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron" <an*******@discussions.microsoft.com> wrote in messagenews:1b****************************@phx.gbl...
Thanks. That did the trick. May I ask this:

Is there a situation where "\n" is preferred over
Environment.NewLine?

If I write data to a delimited text file, does it make

any difference if I end a row of data with "\n" or
Environment.Newline?

The only downside I can see with Environment.Newline is
that it is more chars than "\n".

-----Original Message-----
Ron,

Instead of appending \n, try using

Environment.NewLine.

Also, make sure that the Multiline property is set to
true on the
textbox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron" <an*******@discussions.microsoft.com> wrote in

message
news:0f****************************@phx.gbl.. .
Greetings,

I am writing text to a multi line textbox on a timer

as follows:

txt1.AppendText(@"/* " + DateTime.Now.ToString()

+ "\n");

Here is what gets displayed

/* 1/1/2004 11:12:11 AM|

There is a pipe | char at the end of the string. I am
guessing it is the "\n" carriage return char. How can I write text to the multi line textbox with a newline and without this pipe char?

Thanks,
Ron
.

.

Nov 16 '05 #6

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

Similar topics

1
by: Wootaek Choi | last post by:
I've tried to record some data to the file with C#. The data should be added in the end of log file, And If there is no log file, A new log file should be created to write the data for that...
7
by: Tamir Khason | last post by:
I have textbox. I do something in each Keypress (kindof validation) in order not to rewrite all text inside I'm using AppendText method to write in. BUT I'm unable to add backspace (\b); e.g I have...
7
by: Andrew | last post by:
VB .NET 2003, WinXP Pro: Adding text to a text box with the TextBox.AppendText method limits the amount of text in the textbox to 32K. I have a short program that uses the GetFiles function of...
0
by: parez | last post by:
Hi all! The webclient class's uploadvalues method appends %0d%0a to the last value in the name value collection.. Can any one help me out.. Thanks in advance.. Here is code...
3
by: Fritz Switzer | last post by:
I'm trying to AppendText to a TextEdit. I have a procedure that will go through the controls on a Windows form and return the control that has "focus". I have a number of TextEdits on my form...
3
geo039
by: geo039 | last post by:
I have a mortage calculator in vb.net. I am trying to transferring it into asp.net. Most of everything works from cut and paste except appendtext. I am not sure what to use in place of the...
0
by: rwf_20 | last post by:
I've got a form that contains a RichTextBox control and periodically receives strings to append to it. The function in question is below. I've been receiving mysterious bug reports of application...
2
by: Martin | last post by:
Look at the following code: <?php $year = `date + %Y`; echo "(".$year.")"; ?> The output is (2008 )
4
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a multiline RichTextBox that I use for data logging. I'm concerned about how the AppendText method reacts when over time the maximum number of characters have been added. Do the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.