473,320 Members | 2,071 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,320 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 7997
"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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.