472,119 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Ive been working on this since yesterday and its bugging me. Although the
event is firing, The box does not scroll. Can anyone see what Im doing
wrong. I suspect it is stupidly simple.

TIA

SubClass RichtextBox in order to fire the OnVScroll Event

Public Class MyRichTextBox

Inherits RichTextBox

Public Sub PerformVScroll()

MyBase.OnVScroll(EventArgs.Empty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

RTB.PerformVScroll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RTB.VScroll

Console.WriteLine("Handling scroll")

End Sub


--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.

Nov 20 '05 #1
4 4271
In article <uP**************@TK2MSFTNGP12.phx.gbl>, terry_burnsREMOVE%
FO*********@BTOpenworld.com says...
Ive been working on this since yesterday and its bugging me. Although the
event is firing, The box does not scroll. Can anyone see what Im doing
wrong. I suspect it is stupidly simple.

TIA

SubClass RichtextBox in order to fire the OnVScroll Event

Public Class MyRichTextBox

Inherits RichTextBox

Public Sub PerformVScroll()

MyBase.OnVScroll(EventArgs.Empty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

RTB.PerformVScroll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RTB.VScroll

Console.WriteLine("Handling scroll")

End Sub


You're simply causing all event subscribers to be notified that a scroll
has happened. It's not actually performing the scroll. For that, you
would probably either need to:

1) Send the WM_VSCROLL message to your control.
2) or try the ScrollToCaret() function.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
The carret worked ok so thanks for that. I looked for examples on how to
send messages to the control but of yet have not found any. Do you have a
good reference I can look at ?

Many Thanks

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <uP**************@TK2MSFTNGP12.phx.gbl>, terry_burnsREMOVE%
FO*********@BTOpenworld.com says...
Ive been working on this since yesterday and its bugging me. Although the event is firing, The box does not scroll. Can anyone see what Im doing
wrong. I suspect it is stupidly simple.

TIA

SubClass RichtextBox in order to fire the OnVScroll Event

Public Class MyRichTextBox

Inherits RichTextBox

Public Sub PerformVScroll()

MyBase.OnVScroll(EventArgs.Empty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

RTB.PerformVScroll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RTB.VScroll

Console.WriteLine("Handling scroll")

End Sub


You're simply causing all event subscribers to be notified that a scroll
has happened. It's not actually performing the scroll. For that, you
would probably either need to:

1) Send the WM_VSCROLL message to your control.
2) or try the ScrollToCaret() function.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #3
In article <Ot**************@TK2MSFTNGP11.phx.gbl>, terry_burnsREMOVE%
FO*********@BTOpenworld.com says...
The carret worked ok so thanks for that. I looked for examples on how to
send messages to the control but of yet have not found any. Do you have a
good reference I can look at ?


See this google post:

http://tinyurl.com/m4in

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #4
Excellent Patrick, You have been most helpful this did the trick

;-D

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <Ot**************@TK2MSFTNGP11.phx.gbl>, terry_burnsREMOVE%
FO*********@BTOpenworld.com says...
The carret worked ok so thanks for that. I looked for examples on how to
send messages to the control but of yet have not found any. Do you have a good reference I can look at ?


See this google post:

http://tinyurl.com/m4in

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Rachel Suddeth | last post: by
7 posts views Thread by Richard | last post: by
1 post views Thread by Daniel Friend | last post: by
1 post views Thread by dotnetnoob | last post: by
2 posts views Thread by =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.