Howto make a multipleline textbox auto scroll down

  • 15 years ago

    I am  doing a VB6  development, but I am facing a problem. I have a multipleline textbox(with vertical scroll enbled) in one of the form to print out the log message ... but when the message become longer and longer .. the user need to manual use the mouse to scroll down and see the last message. Can I check how we can set the textbox auto to scroll down and display the last message?

    Thank you.
  • 15 years ago

    Whenever you want to make the control to scroll down the bottom, call this sub with the handle of the control as parameter:

    Public Sub ScrollToBottom(ByVal hWnd As Long)
       SendMessage hWnd, WMVSCROLL, SBBOTTOM, 0
    End Sub

    Of course, I have omitted the declarations of SendMessage and the other constants, but you can get those from API Viewer.

  • 15 years ago

    hi hhfei,

    Use the textbox's Scrolltocaret() property



    Hope it helps.

  • 15 years ago

    try this

    text1.selstart = len(text1.text)

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup