473,563 Members | 2,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.OnVScrol l(EventArgs.Emp ty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles PerformVscroll. Click

RTB.PerformVScr oll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles RTB.VScroll

Console.WriteLi ne("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 4406
In article <uP************ **@TK2MSFTNGP12 .phx.gbl>, terry_burnsREMO VE%
FO*********@BTO penworld.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.OnVScrol l(EventArgs.Emp ty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles PerformVscroll. Click

RTB.PerformVScr oll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles RTB.VScroll

Console.WriteLi ne("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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <uP************ **@TK2MSFTNGP12 .phx.gbl>, terry_burnsREMO VE%
FO*********@BTO penworld.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.OnVScrol l(EventArgs.Emp ty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles PerformVscroll. Click

RTB.PerformVScr oll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles RTB.VScroll

Console.WriteLi ne("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_burnsREMO VE%
FO*********@BTO penworld.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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <Ot************ **@TK2MSFTNGP11 .phx.gbl>, terry_burnsREMO VE%
FO*********@BTO penworld.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9388
by: Rachel Suddeth | last post by:
I want to react to scrolls in a RichTextBox (I want to let the user know when he has changed to a new printable page.) I have handled the VScroll() event, but that only responds to scrollbar clicks. If the user slides the "thumb", I seem to get no indication. Anyone know how to get notified of the thumb slide from a RichTextBox? I can derive...
2
17300
by: JonnyT | last post by:
I searched high and low for an answer on how to auto scroll a richtextbox and now I finally have it. Since it took me a while to get a good efficient way of doing it that didn't require focus to the control or the scrolltocaret method I decided that it would be worth posting to anyone who might have similar concerns. For the record this...
7
2031
by: Richard | last post by:
When you give focus to a RichTextBox, then it goes to the textCursor, but i don't want to give the richtextbox focus, cause there is being written a lot in it, and I have to do something else at the same time, then if I don't give it focus, and I add some text to it, then it don't automaticly scrolls down to the textcursor, is there a way to...
1
5507
by: Daniel Friend | last post by:
How do I scroll to the bottom of RichTextBox Currently tried RichTextBox1.SelectionStart=len(RichTextBox1.text) RichTextBox1.ScrollToCaret This does not work. What is the best what to accomplish this
4
3597
by: D. Yates | last post by:
Hi, When a RichTextBox control doesn't have focus, it DOES NOT scroll to the last line that is added; however, if it does have focus, it WILL scroll to the last line added. I want to stop and start this behavior at will. When I stop the behavior, this will give users a chance to examine the text that is at the top of the document while...
1
2881
by: dotnetnoob | last post by:
i have a Dialog form with richtextbox that basically display a legal agreement and when the user drag the scroll thumb down to the end of scrolling which suppose to mean the user have read it then the checkbox is enabled for the user to tick off (I agree) and the next button is enabled for user to click next. the richtextbox vscroll event only...
1
1436
by: Joe HM | last post by:
Hello - I have a GUI that uses a RichTextBox to output text. The problem is that if this box ouput text while hidden behind another window, it is blank when I bring it to the foreground. The text is there when I click on the scroll button on the scrollbar but it seems to be scrolled "up" all the way. The following code is used to add...
2
9741
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I have a somewhat long calculation report printed out in a RichTextBox. To find or monitor a particular value, users scroll down to the location of the data in the RichTextBox. However, when the user changes the input data, a recalculation is made and a new report is generated. This resets the RichTextBox vertical scroll bar to the top....
1
2887
by: NehaDas | last post by:
Hello Everyone ! Iam relatively new to .NET C# and m still in the process of exploring various options. Any help with regard to this query will be highly appreciated ... Iam working on an application that somewhat is similar to outlook . It will have a list of messages received on top and a reading pane below displaying the message selected by...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.