By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,605 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

"\n" does not work inside a textbox control class

P: n/a
Hi,

i am about to burst!!! how can i make my string break inside a textbox?
i mean with a control charater like "\n", but it does not work!

i have a string and i must set the wrap manuall, not controled by the
wordwrap property of the textbox. as i alread said: "\n" does not work!

Language s C#

how can i solve this.
Best Regards
Kerem Gümrükcü

Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Is the textbox in single-line mode or multi-line?

Best regards,
Jeffrey Palermo
Blog: http://www.jeffreypalermo.com

Nov 16 '05 #2

P: n/a
"Kerem Gümrükcü" <ka*******@hotmail.com> wrote in
news:eh**************@tk2msftngp13.phx.gbl:
Hi,

i am about to burst!!! how can i make my string break inside a
textbox? i mean with a control charater like "\n", but it does
not work!

i have a string and i must set the wrap manuall, not controled
by the wordwrap property of the textbox. as i alread said: "\n"
does not work!

Language s C#

how can i solve this.


Kerem,

Make sure the textbox is set to multiline mode. And use
System.Environment.NewLine instead of "\n".

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #3

P: n/a
Kerem,

Windows systems use \r\n for line breaks, a carriage return and a new
line, like a typewriter

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #4

P: n/a
Remember that this will not work from the design-time. You'll have to write
code manually to set the Text property and you should use the "\r\n"
Carriage-return Line-feed combination such as:

MyTextBox.Text="Hello\r\nWorld";

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Kerem Gümrükcü" <ka*******@hotmail.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
Hi,

i am about to burst!!! how can i make my string break inside a textbox?
i mean with a control charater like "\n", but it does not work!

i have a string and i must set the wrap manuall, not controled by the
wordwrap property of the textbox. as i alread said: "\n" does not work!

Language s C#

how can i solve this.
Best Regards
Kerem Gümrükcü

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.