View Single Post
  #1 (permalink)  
Old 11-04-2008, 2:28 PM
JaedenRuiner's Avatar
JaedenRuiner JaedenRuiner is offline
VB.NET Forum Master
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2007
Age: 31
Posts: 340
Reputation: 81
JaedenRuiner probably authored a book by nowJaedenRuiner probably authored a book by nowJaedenRuiner probably authored a book by now
Default RichTextBox - NewLine

I do quite a bit of formatting in some of my parsing controls, and mostly it is harmless, since the format strings are constants. the line:
Code:
select * from MyTable;
is no different (intrinsically) from
Code:
select *
from mytable
However, the latter of the two is more appealing to the eyes, so while debugging as well as while reformatting the "typed" commands into the editor, it looks more professional and clean. (I also output the formmatted commands to a debug file, but that is of no concern)

So anyway, there I am, I grab from a RichTextBox the command that was typed, (split on the ; character) and I execute in sequence each command, reformatting them and replacing the old with the new as it executes.
But here is the thing:
Code:
Const SQLSELECT = "SELECT {0}" & vbCrLf & "FROM {1}" & vbCrLf
Now, I could use Environment.NewLine as well, but it too equals #13#10 as the standard MSDOS CR/LF line terminator format. Now enter's the brain dead RichTextBox and it strips the #13 character from the strings, so when I try this:
Code:
RichText.SelectionStart = RichText.Text.IndexOf(MySqlString)
It doesn't work (-1 causing exception).

How can I tell the RichTextBox to not strip the carriage return for each new line? I've tried wordwrap = false, but it still keeps only the 10 not the 13.

Thanks
__________________
Jaeden "Sifo Dyas" al'Raec Ruiner
http://www.wayoftheleaf.net/
Reply With Quote