473,379 Members | 1,377 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,379 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 3545

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;...
1
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: 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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.