Numericupdown
-
hi, I have a numericupdown control, I want users be able to increase its value by 0.15 (15 minutes) and when it reaches 60 it becomes 1, actually it works but only when user increase it, for example if its 1.30 and user decrease it it will be 0.85, I know my code has problem but I dont know how to solve it can someone help me?
-
hi, I have a numericupdown control, I want users be able to increase its value by 0.15 (15 minutes) and when it reaches 60 it becomes 1, actually it works but only when user increase it, for example if its 1.30 and user decrease it it will be 0.85, I know my code has problem but I dont know how to solve it can someone help me?
-
hi, I have a numericupdown control, I want users be able to increase its value by 0.15 (15 minutes) and when it reaches 60 it becomes 1, actually it works but only when user increase it, for example if its 1.30 and user decrease it it will be 0.85, I know my code has problem but I dont know how to solve it can someone help me?
And what is the problem? if you set the step value to 0.15 it would increment like so:
0.00
0.15
0.30
0.45
0.60 assume this magically changes into 1.00
1.15
1.30
1.45
1.60 magic required ==> 2.0and decrement like this:
2.30
2.15
2.00
1.85 assume this magically changes into 1.45
1.30
1.15
1.00
0.85 magic required ==> 0.45
0.30
0.15
0.00So all that is needed is two lines of code, according to these rules: if fraction==0.60 add +0.40 if fraction==0.85 add -0.40 Put something to that effect inside the valuechanged handler. Warning: if the control would allow a paste, all kinds of nasty things could happen... :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
And what is the problem? if you set the step value to 0.15 it would increment like so:
0.00
0.15
0.30
0.45
0.60 assume this magically changes into 1.00
1.15
1.30
1.45
1.60 magic required ==> 2.0and decrement like this:
2.30
2.15
2.00
1.85 assume this magically changes into 1.45
1.30
1.15
1.00
0.85 magic required ==> 0.45
0.30
0.15
0.00So all that is needed is two lines of code, according to these rules: if fraction==0.60 add +0.40 if fraction==0.85 add -0.40 Put something to that effect inside the valuechanged handler. Warning: if the control would allow a paste, all kinds of nasty things could happen... :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
thank you man, the problem is that I am not able to find out whether user is increasing the value or decreasing it Should I store its value and check it when the value changed??? or is it possible to use delegates and events.
Shaahinm wrote:
the problem is that I am not able to find out whether user is increasing the value or decreasing it
did I need that information in the two rules: if fraction==0.60 add +0.40 if fraction==0.85 add -0.40 ??? :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig: