Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Lenny on September 20, 2003, 11:26 PM

Title: RTB scroll
Post by: Lenny on September 20, 2003, 11:26 PM
Im looking for a way to make the RichTextBox in vb to scroll back down after resizing.
Title: Re:RTB scroll
Post by: iago on September 21, 2003, 06:26 AM
rtb1.selstart = len(rtb1.text) .. if that's what you mean, great, but I get the impression that you meant something else.
Title: Re:RTB scroll
Post by: Lenny on September 21, 2003, 10:02 AM
Actually that is what i meant....Works :) Thx

Is there a way using WM_(something) to cause it to scroll down?
Title: Re:RTB scroll
Post by: SiMi on September 21, 2003, 11:19 AM
'sets scroll position
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_USER = &H400
Private Const EM_GETSCROLLPOS = (WM_USER + 221)
Private Const EM_SETSCROLLPOS = (WM_USER + 222)
'gets scroll position
Public Type POINTL
   x As Long
   y As Long
End Type
Title: Re:RTB scroll
Post by: Lenny on September 23, 2003, 03:17 PM
Can someone explain exactly that is used?
Title: Re:RTB scroll
Post by: NetNX on December 03, 2003, 09:07 PM
LOL u could just do

Private sub Form_resize()
rtb1.selstart = len(rtb1.text)
End Sub
Title: Re:RTB scroll
Post by: UserLoser. on December 04, 2003, 07:51 PM
Quote from: Lenny on September 23, 2003, 03:17 PM
Can someone explain exactly that is used?


Explains exactly how you can use it here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditmessages/em_setscrollpos.asp).
Title: Re: RTB scroll
Post by: mentalCo. on October 27, 2004, 10:18 AM
What about in vb.net? i am trying :

rtbMain.SelectionStart = Len(rtbMain.Text)


and it isnt working.


edit: got it to work by setting the focus to the RTB first.

rtbMain.Focus()
rtbMain.SelectionStart() = Len(rtbMain.Text)
Title: Re: RTB scroll
Post by: mentalCo. on October 27, 2004, 10:29 AM
by setting the focus creates a huge problem... any other solution for vb.net?