Question:
Visual Basic 2008 - TextBox Scroll Bar?
Samuel
2010-07-23 11:46:55 UTC
Hey guys. I am making a scroll bar for my Textbox1 but how do I make it so the scroll bar actually scrolls the text? what is the script/code?
Four answers:
WGCoder
2010-07-26 11:22:16 UTC
In the TextBox's properties change ScrollBars to Vertical.
MARK
2010-07-23 12:10:10 UTC
I'm assuming that you have your textbox set to 'multi-line' ? ( That is done in the properties window, on the right) If your using a word wrap, once the textbox area is filled, the scrollbar should pop in on it's own if you have the vertical scrollbar set to auto. If you set the horizonal scrollbar to 'auto', then the text will pan right, you DON'T want that! I usually use a RichTextBox to get the auto-scroll, I rarely use a standard textbox for that.



I'm not on my design computer at this time, or I could get a lot more in-depth here. I might add to this when I get home, on my design computer.





I'm home.

To add a scrollbar to your multi-line textbox, just go to the 'Properties' window & select Vertical in the scrollbars line. Your options are None, Vertical, Horizonal, or Both. You want 'Vertical'. It's just that easy. As you type past the parameters of the textbox, the scrollbar will automatically pop in, & start working! That's Easy!!! :-)





There ya go! Good luck, & Happy coding to you!
Lauren
2016-04-17 07:35:11 UTC
You use an event to trigger code that takes whats in the text boox and appends it into a text file. There are several events you can use so choosing which event to trigger one will depend on what you as a programmer and your users want to do. Some events to consider KeyUp KeyDown KeyPressed GotFocus LostFocus Validated TextChanged Other controls like a timer can be used to do a periodic save based upon a time limit. Save every 10 seconds for example. THese evets are good candidates to consider, which one you choose will depend on exactly how you want your program to work. EDIT: Depending upon which event you choose you can have unintended consequences such as triggering a save for each letter being entered. Consider typing "Hello" into a text box You intend to save "Hello" in a file. but if the event handler fires each time you enter a letter your text file could look like H He Hel Hell Hello OR H e l l o neither of these is what I suspect you intend
2010-07-23 11:51:15 UTC
TextBox1.ScrollBars = ScrollBars.Vertical;



^^ that's C# though, should be easy to change to VB


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...