473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to Get the value of scrollbar

Hi!

I am making an application and need to capture the event when RichTexBox
control's vertical scrollbar's values changes. There is an event named
VScroll but it is fired when mouse is first time clicked on scroll bar. I
need the event when the value of scroll bar changes like when we drag the
bullet on the scroll bar or when we manually press the down/Up arrow
button when the textbox is in focus and text is scrolled up or down.

How can I get the value of scrollbar when the event is fired?

It doesn't fire when the bar is pulled....

Any help will be highly appreciated

Thanks in advance

Ahmad Jalil qarshi
Jan 2 '06 #1
2 3543

Ahmad Jalil Qarshi wrote:
Hi!

I am making an application and need to capture the event when RichTexBox
control's vertical scrollbar's values changes. There is an event named
VScroll but it is fired when mouse is first time clicked on scroll bar. I
need the event when the value of scroll bar changes like when we drag the
bullet on the scroll bar or when we manually press the down/Up arrow
button when the textbox is in focus and text is scrolled up or down.

How can I get the value of scrollbar when the event is fired?


Odds are, you can't, at least not with a standard RichTextBox. C#
doesn't
allow for every single event to be captured, just the ones that
programmer
originally thought about.

All is not lost, however. To do this, just derive your own class from
RichTextBox,
override the window procedure, capture the messages you want (in your
case,
WM_VSCROLL with its various parameters set) and create your own events
for it. It really isn't very hard to do, you can find fairly good
examples on
codeproject.com, for example.

Although this particular example is for a listbox, you should be able
to see the
technique involved:
http://www.codeproject.com/cs/combob...ingListbox.asp

Matt

Jan 2 '06 #2
Thanks Matt
"Matt" <ma********@sprynet.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...

Ahmad Jalil Qarshi wrote:
Hi!

I am making an application and need to capture the event when RichTexBox
control's vertical scrollbar's values changes. There is an event named
VScroll but it is fired when mouse is first time clicked on scroll bar.
I
need the event when the value of scroll bar changes like when we drag
the
bullet on the scroll bar or when we manually press the down/Up arrow
button when the textbox is in focus and text is scrolled up or down.

How can I get the value of scrollbar when the event is fired?


Odds are, you can't, at least not with a standard RichTextBox. C#
doesn't
allow for every single event to be captured, just the ones that
programmer
originally thought about.

All is not lost, however. To do this, just derive your own class from
RichTextBox,
override the window procedure, capture the messages you want (in your
case,
WM_VSCROLL with its various parameters set) and create your own events
for it. It really isn't very hard to do, you can find fairly good
examples on
codeproject.com, for example.

Although this particular example is for a listbox, you should be able
to see the
technique involved:
http://www.codeproject.com/cs/combob...ingListbox.asp

Matt

Jan 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Sujan | last post by:
Hello all, Is it possible to remove scrollbar(s) without using frames. Is there any code which could be applied in body tag to remove scrollbar(s). Thanks in adv, Sujan
2
by: Doug Carter | last post by:
I'm using a horizontal scroll bar control to represent teh default values of MIn 0 to Max 100. I assign the current value of the horizontal control to a label control.Text string but when the...
4
by: Price Brattin | last post by:
I dragged a datagrid onto a VB.Net WinForm and used the properties page and a few lines of code to set it up, including the DataSource. No wizard setup was used. It works fine except for one...
0
by: d.steininger | last post by:
Hi there! Is there a way to bind a Textbox.Text to a ScrollBar.Value (not the Textbox-own Scrollbar) and vice versa? The Problem: I have to deal with two controls. The Textbox should accept...
0
by: ManConfusedByMouse | last post by:
Hi all, I AM HAVING PROBLEMS UNDERSTANDING THE UPDATING BEHAVIOR/TIMING OF A WINDOWS.FORMS.SCROLLBAR COMPONENT... quick apology for my sorry posterior if posting in wrong place -- haven't much...
3
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to...
0
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my Win32 application, I've a panel with a picturebox containg a picture, i want that the scrollbar won't start from position 0, but from 120 (for example), on Load i change the value to...
1
by: Victor Hadianto | last post by:
Hi, I have a WPF ScrollBar that had a rather large maximum value. Now the problem is that everytime I click the RepeatButton (the buttons on both side of the Thumb button) it only increases the...
2
by: raknin | last post by:
Hi, I wrote a chat like application in which I use a div to show what was written by each side. I am using the following CSS code: .chatBody { border:1px solid black; background:white;...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.