c# - RichTextBox not processing new line/carriage return characters -



c# - RichTextBox not processing new line/carriage return characters -

i seem experiencing unusual issue richtextbox control, programming in c# in visual studio 2008.

i'm reading stream of file that's beingness written windows console (with output redirection), , i'm reading programme (essentially, i'm recreating what's known in unix world "tail").

when array of bytes read in, i'd homecoming new line line, , go on reading. however, seems rtb not respond new line or carriage homecoming characters. example, i've tried appending \n, \r\n, , environment.newline string beingness written, nil seems working. keeps writing across same line.

here code seems causing trouble:

string convertedbuffer = system.text.encoding.utf8.getstring((byte[])e.userstate); outputbox.appendtext(convertedbuffer + "\n");

i'm @ loss here, can help?

its because set outputbox.multiline property false prevents command showing text in multi-line.

edit: stated @ comment

the byte array beingness sent 1 made of set size, 512. changed 1 fits info beingness filled in it, , now, of sudden, newline character starts working again

here happened:

the string class in c# array of char start pointer first char in array , ends special "terminal" char \0. when phone call system.text.encoding.utf8.getstring(buffer) if buffer size larger string size set remaining chars of string terminal char in char array. array of chars some text\0\0\0, guessing when add together environment.newline add together lastly index of char array after lastly \0 , char array some text\0\0\r\n , because of new line after terminal ignore it.

c# .net string visual-studio-2008 richtextbox

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -