473,320 Members | 1,814 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.

Block NumericUpDown ValueChanged event til button released

116 64KB
Hi

I have a NumericUpDown that triggers quite a substantial amount of calculations when its value is changed.

Therefore it would surely be prudent to not have this firing on every increment if the user wants to use the buttons to change the value through a lot of increments by holding the button down.

Is there a way to prevent the valuechanged event firing until they actually release the button?

Many thanks in advance.
Mar 27 '13 #1

✓ answered by Rabbit

What event are you using? Try using the mouseup event instead.

5 1565
Rabbit
12,516 Expert Mod 8TB
What event are you using? Try using the mouseup event instead.
Mar 27 '13 #2
robertybob
116 64KB
Hi Rabbit,

I originally had a MouseUp which works great for using the buttons but then it doesn't trigger anything if typing the value into the box instead....

Actually, I thought the NumericUpDown didn't like the KeyUp event but seems when I check now the code isn't saying I can't use it - so maybe I can now use a KeyUp and MouseUp event.

The issue there will be forcing the cursor to the end of the NumericUpDown entry after each KeyUp event...

Thanks again.
Mar 27 '13 #3
Rabbit
12,516 Expert Mod 8TB
Sounds like you know what you want to try. Good luck, let us know how you get along.
Mar 27 '13 #4
robertybob
116 64KB
Ok - the decimal place in the NumericUpDown causes a few issues with the KeyUp but I've decided that if it triggers when it gets to a double-digit number input then its ok - they can deal with the 1/10s via the up/down.

So I've separated the MouseUp event to trigger the calculations and the KeyUp events. The KeyUp event code is as follows which seems the best I can do for now but is fine.

Expand|Select|Wrap|Line Numbers
  1. Dim nudcontrol As NumericUpDown = DirectCast(sender, NumericUpDown)
  2. If nudcontrol.Text.Length >= 2 Then
  3. nudcontrol.Select(nudcontrol.Text.Length, 0)
  4. doCalcs()
  5. End If
  6.  
All the best
Mar 27 '13 #5
Rabbit
12,516 Expert Mod 8TB
What do you mean by "best you can do". If you explained what else you want it to do, perhaps we can find a solution.
Mar 27 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
4
by: joe.osowski | last post by:
I've been staring at this a while, and I haven't had much luck with it. So I figure I'll try Usenet. No matter what I try, it seems the event.button property is always "0". Here is my test...
2
by: Javaman59 | last post by:
I want to add a ValueChanged event handler to a control. If I add the handler during form construction then the ValueChanged handler gets called when the control is initialized, and I don't want...
1
by: Ryan Liu | last post by:
I notice System.Windows.Forms.NumericUpDown's ValueChanged event is not always fired, especially edit its text box directly. Is this a known bug or there is something I should pay attention for...
0
by: lechatthierry | last post by:
Is it possible to block a mouse event on an Hyperlink with a general script event? This is quite troublesome for me. I am trying to find a way to block the windows shortcut SHIFT + MOUSE LEFT...
1
by: Neko | last post by:
Is it possible to block a mouse event on an Hyperlink with a general script event? This is quite troublesome for me. I am trying to find a way to block the windows shortcut SHIFT + MOUSE LEFT...
0
by: enantiomer | last post by:
Having a problem with visual studio 2005 doing ASP.net. when in source mode (i.e. looking at the html directly), in the properties toolbar is an option called "DOCUMENT". It has some basic...
3
by: rfinch | last post by:
I'm trying to pass two values from client script (Javascript) to the code-behind for a page using three hidden fields - two to hold the values and a third to fire the ValueChanged event. I have...
2
by: Steven | last post by:
Hello, I want to raise the ValueChanged event ONLY when i move the track bar manually, but not the value changed, how to do in the event below? thank you Private Sub TrackBar1_ValueChanged(ByVal...
0
by: =?Utf-8?B?WVhR?= | last post by:
Hello, I want to raise the ValueChanged event ONLY when i move the track bar manually, but not the value changed, how to do in the event below? thank you Private Sub TrackBar1_ValueChanged(ByVal...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.