Results 1 to 2 of 2
2012-03-03, 23:11 #1
- Join Date
- Jun 2001
- New York, New York, Lebanon
- Thanked 1 Time in 1 Post
2 ways to increment a numeic UpDown
OK am I crazy or what, no this is not my question my question is...
Is there an easy way to have multiple ways to have a numeric UpDown increment by 1 and 10?
Say if you click inside the numeric UpDown it goes by 10, but if you use the Up and down arrows then it goes by 1?
I am hoping this has the same behavoir as the scroll bar.
Thanks for any help.
Wassim<img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>
2012-03-04, 10:19 #2
- Join Date
- Mar 2004
- Manning, South Carolina
- Thanked 1,471 Times in 1,339 Posts
I can't find a way to do this exactly as you want but I have found a work around. It can be done if the control key is pressed while clicking via the SpinDown & SpinUp events. This also requires Windows API code courtesy of Chip Pearson's site. I've attached an Excel workbook example. Of course, I assumed you were talking about a Spinbutton and were working in Office since you didn't specify the language or environment.
Option Explicit 'Note Requires code from Chip Pearson's site see the WindowsAPI module. ' If the Control Key is pressed the following routines will increase/decrease ' the value in the attached cell by 10. The code increments/decrements by 9 ' because the normal operation of the button takes care of the other 1 of the ' increment/decrement Private Sub SpinButton1_SpinUp() If IsControlKeyDown() Then SpinButton1.Value = SpinButton1.Value + 9 End If End Sub Private Sub SpinButton1_SpinDown() If IsControlKeyDown() Then SpinButton1.Value = SpinButton1.Value - 9 End If End Sub