0

During the using of NumericUpDown control in Framework 4.8 version I tent to delete the value inside NumericUpDown control. After leaving the value deleted and empty, the value stays the last input value that I think it should have been reset to 0. I try to refresh, update and validate the control and child controls of NumericUpDown which are UpDownEdit and UpDownButtons but the value doesn't appear in the UI. How do I make the UI to show the value when control loses focus.

Image Explanation Link

I erased the value in control and expected it to be equal to 0 atleast when I lose focus.

UI refresh eventhandler on losing focus:

private void numericUpDown3_Leave(object sender, EventArgs e)
    {
        numericUpDown3.Refresh();
        numericUpDown3.Update();
        numericUpDown3.Validate();

        numericUpDown3.Controls[0].Refresh();
        numericUpDown3.Controls[0].Update();

        numericUpDown3.Controls[1].Refresh();
        numericUpDown3.Controls[1].Update();            
    }
8
  • 1
    Please add Minimal, Reproducible Example. stackoverflow.com/help/minimal-reproducible-example Commented May 12, 2024 at 9:54
  • @SuryatejaKONDLA This is a UI issue. I explained it in the image on the link. In addition I added the refresh code on control. Commented May 12, 2024 at 10:03
  • 1
    "I erased the value in control and expected it to be equal to 0". Not sure why you would expect that totally unjustified thing to happen. Commented May 12, 2024 at 10:08
  • @jmcilhinney I think the value shouldn't be equal to the old value atleast. It is misleading that old value is still there. Commented May 12, 2024 at 10:23
  • numericUpDown3.Value = 0; do the trick. Isn't it? Commented May 12, 2024 at 12:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.