Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to reset the value of numericUpDown control without using value property.
Posted
Updated 10-Apr-20 9:41am
Comments
DamithSL 10-Dec-14 9:51am    
how you add values initially?
Member 10168792 10-Dec-14 10:39am    
Set min & max values, and value of numericUpDown is set by using value property
Daniele Rota Nodari 10-Dec-14 10:26am    
What value do you expect to find after reset? Is 0 okay?
Why you don't want to set Value property? Do you want to avoid firing events or there is some other reason?

You can't "clear" a NumericUpDown - you can only set the Value property to a valid number.

Why don't you want to use the Value? Is it because you are handling the ValueChanged event and don't want it triggered? If so, then just use a class level bool to temporarily disable it.
 
Share this answer
 
domainUpDown1.ResetText();

this is used to reset the domain up down
 
Share this answer
 
You are wasting your time trying to do this.

You can clear the 'Text property by setting it to the empty string, but the Value remains unchanged.

You could call the 'DownButton or 'UpButton methods of the NumericUpDown, and that would decrement, or increment, the Value by the 'Increment Property Value, but under-the-hood that's still setting the 'Value property.

If you are trying to simulate a user manipulating the Control for software testing, then this CodeProject article may be useful: [^]. This CodeProject article is an overview of the open-source testing automation tool 'White: [^].

This open-source tool for .NET simulation of mouse and keyboard activity was just mentioned in CP QA yesterday: [^]:

"The Windows Input Simulator provides a simple .NET (C#) interface to simulate Keyboard or Mouse input using the Win32 SendInput method. All of the Interop is done for you and there's a simple programming model for sending multiple keystrokes."

There are a number of 3rd. party tools, open-source, and commercial for automation for .NET software testing, discussed here: [^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900