sduffy89

sduffy89

  • NA
  • 6
  • 0

RichTextBox Scroll Problem

Jun 1 2004 7:10 PM
Right now i am making a client server chat application but the problem is, neither of the program's RichTextBoxes scroll properly. There's an awquard twist to this problem though... When i change the code of my client to just display the messages straight to the RichTextBox from the combo box, it scrolls fine. But when i have it the way it supposed to work, where it gets text from the BinaryReader that reads from the socket, it doesn't scroll... EVEN THOUGH i use the same method for both of them. It's called "DisplayMessage()". Code for "DisplayMessage()": private void DisplayMessage(string message){ ChatBox.Focus(); message = message.Trim(); ChatBox.SelectionColor = System.Drawing.Color.Black; if (ChatBox.Text == ""){ ChatBox.AppendText(message); } else{ ChatBox.AppendText("\n" + message); } ChatBox.Select(0, ChatBox.Text.Length); //ChatBox.SelectAll(); ChatBox.ScrollToCaret(); InputBox.Focus(); } The messages when read from the BinaryReader are read using the following code: message = reader.ReadString(); I have NOOOO idea what the problem is and quite frankly its pretty darn random in my oppinion. Something else that's odd is that it scrolls just fine for a TextBox component. But i need to be able to have individually colored lines and not have my texbox gray out because its not editable. So i have to use the RichTextBox Control. Help with this would be GREATLY appreciated as this has been the cause of many sleepless nights... (pathetic... i know). Something else that might help is if you could help me get my hands on a custom textbox replacement control. Any fix for this problem would be great. Thanks!

Answers (1)