Lanc1988 Posted December 10, 2004 Posted December 10, 2004 I have a multiline textbox on my form and it is used for a chat and everytime it is recieveing the messages, its moving the scrollbar back to the top.. which isn't going to work good at all for a chat program.. so, I need the code that will keep the scrollbar as long as it will go so each time something new is recieved it will go down more. Quote
Simcoder Posted December 10, 2004 Posted December 10, 2004 I must agree, the scrollbar for the text box can be a pain. Anyways, you can use scrolltocaret, but you must make sure that your text box has focus, which shouldn't be a big deal, because its a chat program. I haven't tested it out, but I think this code should work out, 'Give Your TextBox Focus TextBox1.Focus() 'Append Your Text Here TextBox1.Text &= StrMessage 'Insert The Caret At The End Of The TextBox TextBox1.SelectionStart = TextBox1.Text.Length 'Scroll To The End TextBox1.ScrollToCaret() -=Simcoder=- Quote Whatever thy hand findest to do, do it with all thy heart - Jesus
Lanc1988 Posted December 10, 2004 Author Posted December 10, 2004 thanks, it works very nicely :) 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.