CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Location
    Tallahassee, FL
    Posts
    121

    Auto Scroll Down w/Text Box?

    If I add more and more text into a text box.. I want it to automatically scroll down to see the last information that was added. I've tried to do a SelStart being the last character but it doesn't work correctly.

    Has anyone done something similar?

    Let me know what you did

    Thanks,
    Jv


  2. #2
    Join Date
    Aug 2000
    Location
    Ottawa, Canada
    Posts
    469

    Re: Auto Scroll Down w/Text Box?


    private Sub Text1_Change()
    Text1.SetFocus
    SendKeys "^{END}"
    End Sub



    The idea is to set focus to your text box and then imitate user typing Ctrl+End.
    You can also remembe which control had focus before to be able reset it after.



  3. #3
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Auto Scroll Down w/Text Box?

    I have no problem with keeping the last line added visible using this simple Program. just make sure you have MultiLine set to true

    option Explicit

    private Sub Command1_Click()
    static ctr
    Text1.Text = Text1.Text & "Now is the time " & ctr & vbCrLf
    Text1.SelStart = len(Text1.Text)
    ctr = ctr + 1
    End Sub




    John G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured