473,786 Members | 2,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.To String() + "\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 1820
Ron,

Instead of appending \n, try using Environment.New Line.

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.co m

"Ron" <an*******@disc ussions.microso ft.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.To String() + "\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.New Line?

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.New line?

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

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

Instead of appending \n, try using Environment.New Line.
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.co m

"Ron" <an*******@disc ussions.microso ft.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.To String() + "\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.co m

"Ron" <an*******@disc ussions.microso ft.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.New Line?

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.New line?

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

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

Instead of appending \n, try using

Environment.New Line.

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.co m

"Ron" <an*******@disc ussions.microso ft.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.To String() + "\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.c om> 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.co m>
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.co m

"Ron" <an*******@disc ussions.microso ft.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.New Line?

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.New line?

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

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

Instead of appending \n, try using

Environment.New Line.

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.co m

"Ron" <an*******@disc ussions.microso ft.com> wrote in

message
news:0f***** *************** ********@phx.gb l...
Greetings,

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

as follows:

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

+ "\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
1911
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 reason, AppendText() function used to open the log file. but AppendText() returns StreamWriter object using utf-8 encode mode. What shall i do to get a StreamWriter object using the other encode mode when i use AppendText()?
7
10411
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 to change each ZZ to Z so I want to do myTextBox.AppendText("\bZ"); or (char)8+"Z" - Both writes black square and Z. I know bout the issue of Win32, but is any way to overrde it? TNX -- Tamir Khason
7
6914
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 the directory object, then iterates through the returned array and appends the strings to the textbox. However, if the character count is greater than 32k, no additional text is displayed in the textbox, though no error is raised.
0
1650
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
3061
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 and don't know which control has focus. I then want to paste text from the ClipBoard to this TextEdit control. The following code is what I'm using. Everything works fine, it identifies the correct control,
3
2638
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 appendtext. This snip displays the monthly payments, interest, balance etc For intMonth = 1 To intNumberPayments 'calculate interest paid and balance Dim dblInterestPaid As Double Dim dblBalance As Double ...
0
1282
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 crashes ('Attempt to Read/Write Protected Memory', 'Object Reference not set to instance of an object') which I cannot recreate. In the reports, however, it seems that the crash occurs just after (or possibly during) a sequence of calls to this...
2
1667
by: Martin | last post by:
Look at the following code: <?php $year = `date + %Y`; echo "(".$year.")"; ?> The output is (2008 )
4
13486
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 oldest characters it contains start rolling off the top into the bit bucket, does it simply start silently ignoring appends until some characters, are deleted, or does some kind of exception get thrown? I've heard numerous opinions on what the...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10360
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9960
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7510
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.