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
'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