Click here to Skip to main content
16,008,490 members
Home / Discussions / C#
   

C#

 
Generaldilema with strings and richtextbox Pin
Tyrus18227-Dec-04 16:46
Tyrus18227-Dec-04 16:46 
GeneralRe: dilema with strings and richtextbox Pin
Heath Stewart27-Dec-04 20:34
protectorHeath Stewart27-Dec-04 20:34 
GeneralRe: dilema with strings and richtextbox Pin
Tyrus18228-Dec-04 8:39
Tyrus18228-Dec-04 8:39 
GeneralRe: dilema with strings and richtextbox Pin
Heath Stewart28-Dec-04 9:59
protectorHeath Stewart28-Dec-04 9:59 
GeneralRe: dilema with strings and richtextbox Pin
Tyrus18228-Dec-04 12:09
Tyrus18228-Dec-04 12:09 
GeneralRe: dilema with strings and richtextbox Pin
Heath Stewart28-Dec-04 12:16
protectorHeath Stewart28-Dec-04 12:16 
GeneralRe: dilema with strings and richtextbox Pin
Tyrus18228-Dec-04 12:26
Tyrus18228-Dec-04 12:26 
GeneralRe: dilema with strings and richtextbox Pin
Heath Stewart28-Dec-04 12:34
protectorHeath Stewart28-Dec-04 12:34 
Do not use \r, \n, or \r\n but Environment.NewLine. That will always return the correct line ending for text on the current platform.

Also, what exactly are you trying to do? As I've been trying to get from you this whole time, your code isn't necessarily wrong but what you're attempting to do may be. The RichTextBox.Text property is plain text with only new line and tab characters being supported as the only "format" characters. If you're trying to encode text with color information you need to be modifying the RichTextBox.Rtf property.

Since you're replacing - or at one point was replacing - character with invalid escape sequence the RichTextBox (rather, the Rich Edit common control that is encapsulated) is most likely rejecting the text completely. Immediately after setting base.Text use Marshal.GetLastWin32Error() and compare that with what you see in teh documentation for the Rich Edit Message reference online at http://msdn.microsoft.com/library[^]. You may actually have to look at the headers (installed with VS.NET by default, but you can download them from http://msdn.microsoft.com/platformsdk[^] to see what those error values correspond to.

You should also use a decompiler like .NET Reflector (google for it) to see how the RichTextBox actually sets the text.

Whatever text you're giving to the RichTextBox.Text property is not acceptable, which is what I've been trying to get you to see. The code itself is fine, and my suggestion about using StringBuilder was not to fix your problem but to help you avoid other performance problems with veyr inefficient code.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: dilema with strings and richtextbox Pin
Tyrus18228-Dec-04 12:50
Tyrus18228-Dec-04 12:50 
GeneralRe: dilema with strings and richtextbox Pin
Tyrus18228-Dec-04 13:00
Tyrus18228-Dec-04 13:00 
GeneralperformanceCounter woes Pin
sween327-Dec-04 16:38
sween327-Dec-04 16:38 
GeneralDBAdapter.Fill(), datatype matching. Pin
zecodela27-Dec-04 15:45
zecodela27-Dec-04 15:45 
GeneralRe: DBAdapter.Fill(), datatype matching. Pin
sreejith ss nair27-Dec-04 18:37
sreejith ss nair27-Dec-04 18:37 
GeneralRe: DBAdapter.Fill(), datatype matching. Pin
Heath Stewart27-Dec-04 20:12
protectorHeath Stewart27-Dec-04 20:12 
GeneralRe: DBAdapter.Fill(), datatype matching. Pin
Heath Stewart27-Dec-04 20:20
protectorHeath Stewart27-Dec-04 20:20 
GeneralContainer Window for Minimized forms Pin
hybrid7927-Dec-04 14:25
hybrid7927-Dec-04 14:25 
GeneralRe: Container Window for Minimized forms Pin
Heath Stewart27-Dec-04 20:10
protectorHeath Stewart27-Dec-04 20:10 
QuestionHow to assosiate files to my program Pin
mikker_12327-Dec-04 12:00
mikker_12327-Dec-04 12:00 
AnswerRe: How to assosiate files to my program Pin
Heath Stewart27-Dec-04 20:01
protectorHeath Stewart27-Dec-04 20:01 
QuestionImageList SizeMode ? Pin
geestje27-Dec-04 11:21
geestje27-Dec-04 11:21 
AnswerRe: ImageList SizeMode ? Pin
Heath Stewart27-Dec-04 19:58
protectorHeath Stewart27-Dec-04 19:58 
GeneralRe: ImageList SizeMode ? Pin
geestje28-Dec-04 7:07
geestje28-Dec-04 7:07 
GeneralRe: ImageList SizeMode ? Pin
Heath Stewart28-Dec-04 7:11
protectorHeath Stewart28-Dec-04 7:11 
GeneralRe: ImageList SizeMode ? Pin
geestje28-Dec-04 7:20
geestje28-Dec-04 7:20 
GeneralRe: ImageList SizeMode ? Pin
Heath Stewart28-Dec-04 7:23
protectorHeath Stewart28-Dec-04 7:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.