My problem with NumericUpDown control is when the user selects a value from NumericUpDown And unchecks the checkBox1 and clicks the Save button, the value of NumericUpDown not c
I was using the NumericUpDown control without the spinners because I wanted only numbers. The control was in a child dialog that was invoked from a listview selection. When the value to be loaded into the NumericUpDown control was zero in the listwiew, a zero was in the control. That zero always had to be cleared out. Here's how I made it "appear" blank. If it was zero, I change the ForeColor of the control to white. I added an Enter event that changed the ForeColor to black and deleted the zero.
This hid the NumericUpDown control spinners.
AccessCode.Controls[0].Visible = false;
These statements were in the form initialization. (var code was to be loaded into AccessCode)
if (code == 0)
{
AccessCode.ForeColor = Color.White;
}
The Enter event code looked like this.
private void AccessCode_Enter(object sender, EventArgs e)
{
if (AccessCode.ForeColor == Color.White)
{
AccessCode.ForeColor = Color.Black;
AccessCode.Focus();
SendKeys.SendWait("{Delete}");
}
}
The AccessCode control also had a Leave event that checked for valid data.