|
-
Nov 29th, 2002, 12:48 PM
#1
Thread Starter
Member
Auto scrolling to bottom of textbox. [Resolved]
I am taking string text data and passing it to a Sub. All the text appears in the text box okay, but I can't get the scroll bar to go to the bottom of the textbox. After each new addition of text, the scrollbar stays at the top. Here is the code that I am using:
Private Sub WriteMessage(ByVal message As String)
Me.TextBox1.Text += message + vbCrLf
Me.TextBox1.SelectionStart = Len(TextBox1.Text)
End Sub
I have read other suggestions from the past forums, but those didn't seem to work.
Last edited by Jared; Nov 29th, 2002 at 01:39 PM.
-
Nov 29th, 2002, 01:01 PM
#2
Registered User
Code:
Me.TextBox1.ScrollToCaret()
-
Nov 29th, 2002, 01:04 PM
#3
Thread Starter
Member
Thanks for replying so quickly, but I have tried adding that to the end of the above code, and it didn't work.
Jared.
-
Nov 29th, 2002, 01:08 PM
#4
Registered User
Ok?!? Strange, The code I tried it on was yours.
I added a TextBox1, set the ScrollBars property to Vertical, filled the variable "message" with a text and copied you code from the thread and called it from a button click event.
-
Nov 29th, 2002, 01:15 PM
#5
Thread Starter
Member
It worked!
When I tried previously, I must have made a mistake the first time when I put the line in.
Thanks!
Jared.
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
|