473,395 Members | 1,956 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,395 software developers and data experts.

NumericUpDown

i need help whit the numericUpDown

I tried many ways but first let me explain the objective of the
control

1 - range from 1 to 100
2 -the person can enter higher value that 100 but it put back to 100
and popup the person
3- when pressing up it goes to closest increment of 25 (25-50-75-100
are possible value)
4- when pressing down it goes to closest increment of 25 (75-50-25-1)

the first thing is that 1 next increment of 25 isnt 25 but 26
ok so i set on the value change is the value happen to be 26 set value
to 25.
by default problem 2 is solved by itself nearly because numeric value
under minimum set back to minimum and value over maximum set to
maximum. the popup i was able with the Keypress check the numeric.text
and test if it was higher than the maximum and i made the popup it
work fine

the problem is. when i manually change value it trigger the
valuechange and the click up or down also trigger it.

if anyone know how i can capture in the valuechange has been triggered
by the up and down button or not i would be able to test all this.

if i put in the value change :
if(numeric.value >0 && numeric.value <25)
{
numeric.value = 25;
}
it work to go up to closest 25 increment but if i type 19 for example
and want 19 it doesnt distinguish if i clicked up to go to 25 or if i
change the value to 19 for him both trigger the code but it work only
for 1.

Oct 11 '07 #1
5 8011
"Franck" <th***********@hotmail.comwrote:
i need help whit the numericUpDown [...]
private bool _suspendHandler = false;

private void numeric_ValueChanged(object sender, EventArgs e)
{
if (!_suspendHandler && numeric.Value == 26)
{
_suspendHandler = true;
numeric.Value = 25;
_suspendHandler = false;
}
}

private void Form1_Load(object sender, EventArgs e)
{
numeric.Increment = 25;
numeric.Minimum = 1;
numeric.Maximum = 100;
numeric.ReadOnly = true; // disallow typing a value
}

Eq.
Oct 11 '07 #2
"Franck" <th***********@hotmail.comwrote:
i need help whit the numericUpDown [...]
private void numeric_ValueChanged(object sender, EventArgs e)
{
if (numeric.Value == 26)
{
numeric.Value = 25;
}
}

private void Form1_Load(object sender, EventArgs e)
{
numeric.Increment = 25;
numeric.Minimum = 1;
numeric.Maximum = 100;
numeric.ReadOnly = true; // disallow typing a value
}

Eq.
Oct 11 '07 #3
The original post wants the ability to type values into the control.

Sorry, I cannot figure this one out either. There is no arrow click event.
Maybe if you can inherit a user control from NumericUpDown, you could figure
out the events to signal a user defined event to handle. That would be what
I would investigate...

"Paul E Collins" wrote:
"Franck" <th***********@hotmail.comwrote:
i need help whit the numericUpDown [...]

private void numeric_ValueChanged(object sender, EventArgs e)
{
if (numeric.Value == 26)
{
numeric.Value = 25;
}
}

private void Form1_Load(object sender, EventArgs e)
{
numeric.Increment = 25;
numeric.Minimum = 1;
numeric.Maximum = 100;
numeric.ReadOnly = true; // disallow typing a value
}

Eq.
Oct 12 '07 #4
the closer solution ive come to so far would be a textbox checking for
numeric value and reating myselft up and down button or a vertical
scrollbar if more look like the up and down button

Oct 12 '07 #5
Nobody should ever use NumericUpDown. The control has major bugs on
handling focus and validation. Inherit from the NumericUpDownBase and
write your own.

Oct 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

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
0
by: Koert | last post by:
Hi, In the NumericUpDown control I have to detect that Tab was pressed so I have overroden the PreProcessMessage function. In for example the DateTimePicker this works fine but not in the...
10
by: Bonj | last post by:
I'm using a number of NumericUpDown controls on my form, which controls printer settings such as number of pages. However I want to override one of the default behaviours of the control, namely...
0
by: Koert | last post by:
Hi In the NumericUpDown control I have to detect that Tab was pressed so I have inherited the NumericUpDown and overroden the PreProcessMessage function. In the DateTimePicker (for example) this...
3
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me...
4
by: illegal.prime | last post by:
Hey all, I have a NumericUpDown control on a Panel or potentially a Form that have AutoScroll enabled. When the NumericUpDown is active I would like the Form/Panel/whatever not to scroll when I...
5
by: Len Weltman | last post by:
I am trying to pass a NumericUpDown object into a class method using Visual Studio 2005, but the control type is not found in Intellisense and the type declaration is flagged as an error. Here...
2
by: Stephan Zaubzer | last post by:
Hi all, I encountered a problem with NumericUpDown yesterday and managed to reproduce the error with a very easy examle. I have a Windows Application with only one Form, which contains only one...
0
by: WtFudgE | last post by:
Hi, I'm using a numericupdown to represent the number of items in a listbox. It's supposed to add more items to the listbox if i change the value of the numericupdown. I used to did this with a...
2
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello experts, I posted a disturbing question in here:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.