|
-
Feb 27th, 2011, 01:03 PM
#1
Thread Starter
Lively Member
Increment and decrement in a NumericUpDown button
I would like a program that will use a NumericUpDown button:
-when the up arrow is clicked, the number in the NumericUpDown box will increment by 2
-when the down arrow is clicked, the number in the NumericUpDown box will decrement by -2
I got the button inserted and double clicked on it to get the NumericUpDown1_ValueChanged but am stuck there. I looked thru the MSDN site but no help there. Does anyone have any suggestions?
-
Feb 27th, 2011, 01:09 PM
#2
Addicted Member
Re: Increment and decrement in a NumericUpDown button
Can you explain in more details ?
-
Feb 27th, 2011, 01:22 PM
#3
Thread Starter
Lively Member
Re: Increment and decrement in a NumericUpDown button
When you click the up arrow button it only increments by "+1". Also when you click the down arrow button it only decrements by "-1". I want to increment by a higher number say 2,5 or 100. Also can it be done in a separate subroutine then it could activate the main subroutine with a call after each increment.
-
Feb 27th, 2011, 01:43 PM
#4
Re: Increment and decrement in a NumericUpDown button
 Originally Posted by Philosophaie
I looked thru the MSDN site but no help there. Does anyone have any suggestions?
It really concerns me when I see posts like this because it makes me wonder where you actually looked. You apparently didn't look in what I would consider to be the obvious place, i.e. the documentation for the NumericUpDown class itself.
http://msdn.microsoft.com/en-us/libr...VS.100%29.aspx
Not too far down the list of members is the Increment property, described thusly:
Gets or sets the value to increment or decrement the spin box (also known as an up-down control) when the up or down buttons are clicked.
That is obviously what you want so, as I said, your claim that MSDN was no help is false. You just didn't look in the right place. You should always look in the obvious places first, and the documentation for the type or member you're using is the most obvious place.
Don't assume that something is difficult and complex. Assume that it's simple and look for a simple solution first. Only look for difficult and complex solutions if no simple option presents itself.
Speaking of simple solutions and obvious places, did you not think to look in the Properties window? The Increment property is there, described thusly:
Indicates the amount to increment or decrement on each button click.
Again, quite obviously what you want, but you won't see if you don't look.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|