473,471 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Appending text with newline in a textbox

Hi All,

I'm having a heckuva time trying to append lines into my multiline readonly
System.Windows.Forms.TextBox

I was expecting to simply do this:

myTextBox.Text += "appending this line \n";

but it doesn't append a newline at the end of my string. It justs adds a
little black box character at the end and new appends just continue as one
long line.... arg.

What am I doing wrong? I just want to echo messages to the form....

Rein
Nov 15 '05 #1
7 17742
append Environment.NewLine. See class doc for same.
"Rein Petersen" <rm********@bogus.hotmail.com> wrote in message
news:uP****************@TK2MSFTNGP12.phx.gbl...
Hi All,

I'm having a heckuva time trying to append lines into my multiline readonly System.Windows.Forms.TextBox

I was expecting to simply do this:

myTextBox.Text += "appending this line \n";

but it doesn't append a newline at the end of my string. It justs adds a
little black box character at the end and new appends just continue as one
long line.... arg.

What am I doing wrong? I just want to echo messages to the form....

Rein

Nov 15 '05 #2
Hi Rein,

"\r\n" instead of "\n" will do the job.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"Rein Petersen" <rm********@bogus.hotmail.com> wrote in message
news:uP****************@TK2MSFTNGP12.phx.gbl...
Hi All,

I'm having a heckuva time trying to append lines into my multiline readonly System.Windows.Forms.TextBox

I was expecting to simply do this:

myTextBox.Text += "appending this line \n";

but it doesn't append a newline at the end of my string. It justs adds a
little black box character at the end and new appends just continue as one
long line.... arg.

What am I doing wrong? I just want to echo messages to the form....

Rein

Nov 15 '05 #3
"Miha Markic" <miha at rthand com> wrote in message
news:ez**************@tk2msftngp13.phx.gbl...
"\r\n" instead of "\n" will do the job.


Already tried "\r\n" ... carriage return newline... nogo :(

Rein
Nov 15 '05 #4

"Fred Mellender" <no****************@frontiernet.net> wrote in message
news:_X****************@news01.roc.ny...
append Environment.NewLine. See class doc for same.


Thats it!!

myTextBox.Text += "some text to append and here comes the newline" +
Environment.Newline;
Rein
Nov 15 '05 #5
Actually, it is a go.
Environment.NewLine gives exact same value as "\r\n".

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"Rein Petersen" <rm********@bogus.hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Miha Markic" <miha at rthand com> wrote in message
news:ez**************@tk2msftngp13.phx.gbl...
"\r\n" instead of "\n" will do the job.


Already tried "\r\n" ... carriage return newline... nogo :(

Rein

Nov 15 '05 #6
Thats what I would have thought. Of course I tried it and was completely
stymied when the character escapes ("\r\n") didn't produce a newline...
Maybe I used the wrong slashes (doubt it). I'll try it again later for good
measure and let everyone know result (don't want to misinform).

Rein

"Miha Markic" <miha at rthand com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Actually, it is a go.
Environment.NewLine gives exact same value as "\r\n".

Nov 15 '05 #7
I've tried with this:
textBox1.Text = "Tubo\r\nTubo";

(textBox1.Multiline should be True)

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"Rein Petersen" <rm********@bogus.hotmail.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
Thats what I would have thought. Of course I tried it and was completely
stymied when the character escapes ("\r\n") didn't produce a newline...
Maybe I used the wrong slashes (doubt it). I'll try it again later for good measure and let everyone know result (don't want to misinform).

Rein

"Miha Markic" <miha at rthand com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Actually, it is a go.
Environment.NewLine gives exact same value as "\r\n".


Nov 15 '05 #8

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

Similar topics

6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
2
by: Stephen Tang | last post by:
Hi, I'm relatively new at this language, so I've been trying to find parallels to problems I've run into in the past. This is the hypothetical problem: I want to write a CD inventory...
22
by: Tim | last post by:
Hi A while ago I got some help in writing a mock console. The idea was to write a VB app that contained a textbox, then run a process from within the app and redirect the stdout to the textbox. ...
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
4
by: Bill Rowell | last post by:
This question is driving me nuts because I'm sure its easy to do... If I have a text box control and a user enters some text with new line characters in it, how could I turn around and parse that...
5
by: UJ | last post by:
I have a user control that inherits from the standard windows text box. I have a routine that adds stuff to it. I have compiled it into a dll. I have added it to my app and I can debug into it. I...
2
by: nhaydon | last post by:
There has to be way to do this. Any help would be appreciated. Here is the code. txtReturn.Text = data + Environment.NewLine + data + Environment.NewLine + data + Environment.NewLine + data +...
3
by: ad | last post by:
I have set a TextBox to MultiLines and set the rows to 10. I assigned the Text of the TextBox some lins of text at desgin time, but only the first line remain in the TextBox. How can I assign...
13
by: sherifffruitfly | last post by:
Hi all, I'm trying to distill all of the info from google searches into what I need, with partial success. In truth, the whole xmlNode, Document, Element, etc group of classes & methods is going...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.