467,883 Members | 1,289 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,883 developers. It's quick & easy.

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

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
  • viewed: 3889
Share:
4 Replies
Is the textbox in single-line mode or multi-line?

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

Nov 16 '05 #2
"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
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
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.

Similar topics

3 posts views Thread by ¤ Alias | last post: by
7 posts views Thread by relient | last post: by
5 posts views Thread by spacecoyote | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.