473,715 Members | 6,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

scrollbar.scrol l event occuring twice

I am curious as to why the scrollbar.scrol l event gets called twice

Here is an example of my code
Private Sub vsbMoveCar_Scro ll(ByVal sender As System.Object,
ByVal e As System.Windows. Forms.ScrollEve ntArgs) Handles vsbMoveCar.Scro l
'Position the up and down movemen
'Used when the scroll box is move

picCar.Top = vsbMoveCar.Valu
X +=
Label1.Text = CStr(X

End Su

When I click on the scrollbar X gets incremented twice. Why is this event being called twice? I would greatly appreciate some insight into this

I know that there is a keydown and keyup event, but I don't think this is what's doing it.

Nov 20 '05 #1
1 3386
Check the type member of the ScrollEventArgs variable. It will be one of the
ScrollEventType members such as LargeIncrement, SmallIncrement, EndScroll,
etc. I suspect that you are getting an EndScroll message sent after the
Increment/Decrement message. Simply check to see that the type is indicating
that a scrollbar movement actually occurred and that it's not signalling the
end of the movement.

Scott
"johnperkin s" <an*******@disc ussions.microso ft.com> wrote in message
news:CD******** *************** ***********@mic rosoft.com...
I am curious as to why the scrollbar.scrol l event gets called twice.

Here is an example of my code:
Private Sub vsbMoveCar_Scro ll(ByVal sender As System.Object, _
ByVal e As System.Windows. Forms.ScrollEve ntArgs) Handles vsbMoveCar.Scro ll 'Position the up and down movement
'Used when the scroll box is moved

picCar.Top = vsbMoveCar.Valu e
X += 1
Label1.Text = CStr(X)
End Sub

When I click on the scrollbar X gets incremented twice. Why is this event being called twice? I would greatly appreciate some insight into this.
I know that there is a keydown and keyup event, but I don't think this is what's doing it.

Nov 20 '05 #2

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

Similar topics

4
4847
by: Ross | last post by:
I have been using the following script to return a scrollbar to the position it was in before the data was posted. It works in ie but not in firefox. Thanks, R. <script type="text/javascript"> window.onload = function(){ var strCook = document.cookie;
22
2349
by: Colin McGuire | last post by:
I apologize for posting yet another scrollbar question. Here is my code. All I want is for a diagonal line to appear from coordinates (0,0) to (width,height) in a usercontrol regardless of whether the user autoscrolls the usercontrol (other things that are on the usercontrol I want to scroll, but haven't included any here). Here are the steps to reproduce my problem. 1. Launch Visual Studio and create a new Windows application with...
1
11285
by: Nicholas Shewmaker | last post by:
(I apologize if this posts twice. My AVG is being fussy.) From what I've read, MouseWheel is a very tricky event. I have replaced my Python tcl84.dll and tk84.dll files with those in the ActiveTcl distribution to fix the crashes caused by the event. Then, I managed to see that my test script (see code below) was registering the event by printing the delta value (+/- 120). ----------------- from Tkinter import *
7
9375
by: Pachydermitis | last post by:
Hi all you Experts, I need to scroll a listbox horizontally. For the life of me I cannot get it to move. I can successfully scroll it vertically. I have the handle for the listbox and the scroll bar. I have even tried sending it vbKeyRight to no avail, but it doesn't register the key strokes. I am using lDirection = WM_HSCROLL
2
3561
by: Ahmad Jalil Qarshi | last post by:
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 ...
6
1501
by: Steve Barnett | last post by:
I think I'm going nuts... Put a scroll bar control on a form and in the form_load method, initialise it as follows: vScrollBar.Minimum = 0; vScrollBar.Maximum = 10; vScrollBar.SmallChange = 1; vScrollBar.LargeChange = 10; vScrollBar.Value = 0; vScrollBar.Visible = true;
3
11848
by: jkarpago | last post by:
Hi: I have a javascript that creates a custom scrollbar for a div in the middle of my page. The problem is that when I scroll in my div it scrolls the div and the scroll of the page so I loose the position i want and exists from my div. So , what I want is to lock the window scrollbar in the moment I am over my div, so I can scroll my div without any window movement.
2
7447
by: Rich | last post by:
Hello, Some database applicatins have a tooltip feature where when you are dragging the scrollbar of the table view a tooltip appears next to the mouse cursor displaying the approximate record number you are scrolling past (Excel, Access). Sql server has the rownumbers on the Row Header column of its table view. Ideally, I would like to add row numbers to the Row Header column of the datagridview like sql server - Any suggestions...
0
1263
by: =?Utf-8?B?c2RhbmllbEBhaWc=?= | last post by:
I am having some issues with the standard Windows scrollbar. I am using MS Visual Studio 2005. Code is C#. The application is a Windows Forms app. The tool is a vertical scroll bar from the toolbox. I am attempting to perform a simple operation on a global class variable (not a methods local variable) such as an integer increment (like myInt++ ). Grabbing the scroll bar and dragging it produces the thumbtrack event in the scroll method....
0
8718
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9340
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9103
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6646
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5967
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.