Click here to Skip to main content
15,742,619 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm looking for tips on how to activate the vertical scroll bars in a textbox only if the textbox is full. If there's only one paragraph or so, I don't need the scroll bar. But if the whole textbox is full, I want to turn it on. How do I tell the textbox to turn on its scroll bars only if the text has gone below the bottom line?

I'm guessing there are a few ways of doing this. I thought about going brute force with the Len function but that doesn't work if the user adds in carriage returns to the text. I need to know when the text has gotten to the last printable position in the textbox.

Plan B is to use a monospaced font, figure out exactly how many characters are in a line, divide those lines into paragraphs, and just do some fancy math to pinpoint exactly when the typing position reaches the bottom right of the page. Then turn the scroll bars on. That seems kind of clunky though, just to turn the scroll bars on. Is there an easier way?

Thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900