Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

line break in a windows application
Hello, All!

I have created an application with a multiline textbox on the form.
When I press a button, it has to show something and then break
the line and show something else.
I tried "\n", ((char)13) and ((char)10) - they don't work.
When I enter a break by hand (just press enter) and run through
each character in that string, the line break character has code
13 10 (yes, 2 numbers for some reason)
The possible reason is that 'Enter' is a "control" key (a char with
ASCII code less than 32) - they usually return 2 numbers...

What should I do to break line in the textbox?
Alternative way was to use TextWriter:
string LineBreak=(new System.IO.StringWriter()).NewLine;

but there must be another way of doing it...
and then just use that string:
this.TextBox1.AppendText("Hello"+LineBreak+"World");

That is kind of stupid...

With best regards, Nurchi BECHED.



Report this thread to moderator Post Follow-up to this message
Old Post
Nurchi BECHED
08-14-04 01:57 AM


Re: line break in a windows application
quote:
Originally posted by Nurchi BECHED Hello, All! When I enter a break by hand (just press enter) and run through each character in that string, the line break character has code 13 10 (yes, 2 numbers for some reason) The possible reason is that 'Enter' is a "control" key (a char with ASCII code less than 32) - they usually return 2 numbers...
Windows line breaks *are* two characters. A linebreak on windows is \n\r -- a linebreak followed by a carriage return (13 10 in decimal). So, what you see is normal. This should help you with generating linebreaks for windows users, but be ca reful. Each of the major platforms handles linebreaks differently: WINDOWS: \n\r UNIX: \n MACINTOSH: \r I leave it up to you to figure out how to decide which type of linebreak to generate. Cheers, taylor

Report this thread to moderator Post Follow-up to this message
Old Post
tbarstow
08-19-04 07:38 PM


Re: line break in a windows application
Thu, 19 Aug 2004 14:38:12 -0500
tbarstow <tbarstow.1bbz5u@mail.codecomments.com> schrieb:

[Schnipp]

>Windows line breaks *are* two characters.  A linebreak on windows is
>\n\r -- a linebreak followed by a carriage return (13 10 in decimal).

Small nitpick, carriage return ('\r') followed by a linefeed ('\n').


--
Jan v/d Broek
balglaas@xs4all.nl

"Geef je over, wy zyn Bassie en Adriaan, weerstand is nutteloos"

Report this thread to moderator Post Follow-up to this message
Old Post
Jan van den Broek
08-24-04 01:57 AM


Re: line break in a windows application
System.Enviroment.NewLine

Report this thread to moderator Post Follow-up to this message
Old Post
Samuel Hon
08-24-04 02:07 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

C# archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.