kanak Posted February 7, 2005 Posted February 7, 2005 i m facing a problem in a rictextbox control.... that is the vertical scroll bar i m developing a chat window where the message recieved is shown in a richtextbox ... Now the problem which i am facing is that when the message content is more than the size of the richtextbox... then the vertical scrollbar is displayed.. but the scroll bar is not getting attached to the bottom position ... whenever a new message comes the scroll bar moves up .. and the message is not visible ... i have to move the scroll bar down to the bottom position to c the message... how to make the vertical scroll bar position to the bottom ... so that the latest message can be seen without scrolling to the bottom... for example u can try this.. create a richtextbox , a textbox, button.. type something in the textbox and click the button on button click richtextbox.text=richtextbox.text + textbox1.text view the result when the messages r more then the size of the richtextbox... i hope u might get the problem i am facing Quote
RobEmDee Posted February 8, 2005 Posted February 8, 2005 kanak: Give this a try: private void AddMessage(string message) { // Make RichTextBox active this.rtbTest.Focus(); // Append Message this.rtbTest.AppendText(message); // Put the cursor at the very end of the text this.rtbTest.Select((this.rtbTest.Text.Length), 0); // Scroll this.rtbTest.ScrollToCaret(); } Quote
kanak Posted February 8, 2005 Author Posted February 8, 2005 hey thanks a lot man ... its workied perfectly fine Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.