VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Scroll to bottom of a loaded multiline Text Box

by Mike Burke (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 12th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Scroll to bottom of a loaded multiline Text Box

Rate Scroll to bottom of a loaded multiline Text Box



'vertical scroll bar, and scroll to the end

Dim logfile as string
Dim LogFileNum as Integer

'Put the file contents into the textbox (txtLogFileContents)
LogFileNum = FreeFile
Open logfile For Input As #LogFileNum    
txtLogFileContents.Text = Input$(LOF(LogFileNum), #LogFileNum)
Close LogFileNum

'Scroll to end of text box
'NOTE: I tried txtLogFileContents.SetFocus but I got an error 5 on compile
txtLogFileContents.SelStart = Len(txtLogFileContents.Text)  'sets focus
SendKeys "^{end}"                         'advances scroll to end


Download this snippet    Add to My Saved Code

Scroll to bottom of a loaded multiline Text Box Comments

No comments have been posted about Scroll to bottom of a loaded multiline Text Box. Why not be the first to post a comment about Scroll to bottom of a loaded multiline Text Box.

Post your comment

Subject:
Message:
0/1000 characters