SetScrollPos

cRuLo

Member
Joined
Jun 20, 2003
Messages
10
I have got the function working, but I cannot get the RichTextBox to actually scroll to the of the scrollbar. If I click on the scrollbar it scrolls to the value, but only if I click on it.... can anyone think of a solution?

Code:
                Dim s As String,Value, Min, Max, temp As Integer

                GetScrollRange(rtbData.Handle, ScrollBarFlags.SBS_VERT, Min, Max)
                Value = GetScrollPos(rtbData.Handle, ScrollBarFlags.SBS_VERT)

                If Max - Value = rtbData.Height Or Max - Value = rtbData.Height - 1 Or Max - Value = 0 Then
                    rtbData.SelectionStart = rtbData.TextLength
                    rtbData.SelectedRtf = s
                    rtbData.SelectionStart = rtbData.TextLength
                Else
                    temp = rtbData.SelectionStart
                    rtbData.SelectionStart = rtbData.TextLength
                    rtbData.SelectedRtf = s
                    rtbData.SelectionStart = temp
                    SetScrollPos(rtbData.Handle, ScrollBarFlags.SBS_VERT, Value, True)
                End If

                 This code scrolls the scrollbar if it is at the max value, if not, it does not scroll.
                 Look at the chat windows in AIM and mIRC to see at what Im trying to accomplish.
 
Back
Top