Hello,

I have a small problem ; I have found an alternate solution but I
don't like it.

The problem is simple, let's take a form, a numericUpDown inside and a
button that will show the value of the numericUpDown in a MessageBox
(or elsewhere, whatever).
Let's say you put '5' in the numericUpDown, click the button, "5", ok.
Now, erase the '5' in the numericUpDown, click the button, still "5"
but _nothing_ in the numericUpDown.

My problem is that I would like to catch when the user erases what's
inside the numericUpDown in order to put in the MinimumValue or just
display the actual Value.
Of course, I don't want it to be ReadOnly.

My alternate solution is to use numericUpDown.UpButton() then
numericUpDown.DownButton() but as I said, I don't like it.

If anyone has encountered the same problem and found a (better)
solution, I would like to read it.
Thanks,
--
neva

RE: Empty NumericUpDown by CiaranODonnell

CiaranODonnell
Fri Apr 27 10:18:00 CDT 2007

handloe the validating event and use the text property. Text doesnt appear in
the intellisense but all controls have it so it does compile and work.

private void numericUpDown1_Validating(object sender, CancelEventArgs e)
{

if (numericUpDown1.Text == "")
{
numericUpDown1.Value = 0;
}
}

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


"neva" wrote:

> Hello,
>
> I have a small problem ; I have found an alternate solution but I
> don't like it.
>
> The problem is simple, let's take a form, a numericUpDown inside and a
> button that will show the value of the numericUpDown in a MessageBox
> (or elsewhere, whatever).
> Let's say you put '5' in the numericUpDown, click the button, "5", ok.
> Now, erase the '5' in the numericUpDown, click the button, still "5"
> but _nothing_ in the numericUpDown.
>
> My problem is that I would like to catch when the user erases what's
> inside the numericUpDown in order to put in the MinimumValue or just
> display the actual Value.
> Of course, I don't want it to be ReadOnly.
>
> My alternate solution is to use numericUpDown.UpButton() then
> numericUpDown.DownButton() but as I said, I don't like it.
>
> If anyone has encountered the same problem and found a (better)
> solution, I would like to read it.
> Thanks,
> --
> neva
>
>

Re: Empty NumericUpDown by neva

neva
Mon Apr 30 07:09:55 CDT 2007

On 27 avr, 17:18, Ciaran O''Donnell
<CiaranODonn...@discussions.microsoft.com> wrote:
> handloe the validating event and use the text property. Text doesnt appear in
> the intellisense but all controls have it so it does compile and work.
>
> private void numericUpDown1_Validating(object sender, CancelEventArgs e)
> {
>
> if (numericUpDown1.Text == "")
> {
> numericUpDown1.Value = 0;
> }
>
> }

Oh...
Thanks a lot Ciaran,
We learn things everyday
--
neva