Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

numericUpDown Control

Status
Not open for further replies.

q1212

Programmer
Mar 20, 2009
14
RO
I have a little bug : when I play around of value 10, it still become 11. After it become 11 it decrement with 10 and jump to number 1 directly. how to clean this up?
(when I am at value 10, I go up to 20, then go down back to 10, and when I click to go up again it transform to 11).

Code:
int lastValue = 0;
private void numericUpDown1_ValueChanged_1(object sender, EventArgs e)
{

if (numericUpDown1.Value < 10)
{ numericUpDown1.Increment = 1; }
else
{ numericUpDown1.Increment = 10; }

if ((numericUpDown1.Value == 10) && (lastValue > 10))
{
numericUpDown1.Increment = 1;
}
lastValue = (int)numericUpDown1.Value;

}
 
(when I am at value 10, I go up to 20, then go down back to 10, and when I click to go up again it transform to 11).
this doesn't make sense from a user experience point of view. I'm sure it's possible, but why? the user would have to know how the incrementer works into order to scroll through the numbers. the user should be able to manually override the number by typing it in directly.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
well, this is the bug i want to get rid of.
:)
the behavior of this control is for some small tuning capabilities.
you have an answer to this problem? anything that can put me on the right track?
thx in advance.
;]
 
I find this user experience cryptic. to get to eleven I need to.
1. increment to 10
2. step up 1 to 20
3. step down 1 to 10
4. step up 1 to ll

I would go 1 of 2 routes:
1. pick a step level and stick with it (1, 5, 10).
2. give the user an option to change the step levels. like a radio button with options 1, 5, 10 and the spinner. depending on the current value of the radio buttons will be the incremental value of the spinner.

this way the user explicitly knows what the next step will be.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top