|
-
May 30th, 2001, 02:57 PM
#1
Thread Starter
Hyperactive Member
textbox help needed....
Well... this sounds simple but I can't figure it out. Anyway, here goes the problem: I have a textbox (text1) with a bunch of text in it. It's "multiline" option is set to "true" and has a scrollbar. How can I make it automatically start the scroll bar at the bottom, showing the last bit of text in the textbox (text1) first, instead of showing the top part of the text first automatically? Thanks for taking the time to read this... Any help is appreciated,
-zer0 flaw
-
May 30th, 2001, 03:11 PM
#2
Member
When you want to scroll to the end use the line :
TextBoxName.SelStart = Len(TextBoxName.Text)
Depending on when you need it, either put it in a button or in the Form Load event or whatever.
Boring signature included.
VB6 SP3.
-
May 30th, 2001, 03:17 PM
#3
Frenzied Member
That just puts the cursor at the end of the box. It does not put the scroll bar all the way at the end. I am looking for an api that does it or kinda like raise event to simulate the click to the bottom. I am surprise that there is not an Min Max for the scroll bars.
TextBoxName.SelStart = Len(TextBoxName.Text)
-
May 30th, 2001, 03:33 PM
#4
Member
Hey jjoritz
Did you do a test at all?
I went in and set up a demo project with a text box and a button.
I put that line in the button's on click event and what it did was scroll the scroll bar to the very bottom. I modified the button by adding the line
TextBoxName.SetFocus
and now it scrolls the text box and scroll bar to the bottom and puts the cursor at the end.
Boring signature included.
VB6 SP3.
-
May 30th, 2001, 03:37 PM
#5
Frenzied Member
Yeah that does work. I put it in the Form_Load and it does not work. Like for example lets say that you check the len of the text on start of the app so i did it on the load. Well the cursor goes to the end but the scroll bar stays at the top.
-
May 30th, 2001, 03:40 PM
#6
Frenzied Member
well anywayz try this link. It has pretty cool stuff working with the api to get control of the textbox. Let's not argue about this. Problem resolved.
vbworld - textbox - extending the api
-
May 30th, 2001, 03:52 PM
#7
Member
Fair enough
All that's a bit complex for someone as new to VB as me.
The simple solution I found was to stick:
Text1.SelStart = Len(Text1.Text)
Text1.SetFocus
in the TextBoxName_GotFocus() event. But then I suppose that worked 'cause TextBoxName had the index of 0.
Boring signature included.
VB6 SP3.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|