9

I have a Windows Forms application that includes NumericUpDown control With Minimum and Maximum values set to (50:80) accordingly and step 1.

When form loads the NumericUpDown shows 50.

I know that NumericUpDown is for picking numbers and numeric types and always has a value, but is there any way to make it show empty when form loads?

default locale
  • 13,035
  • 13
  • 56
  • 62
user3123337
  • 101
  • 1
  • 1
  • 3
  • are you just trying to avoid the change event when the form loads? Numerics default to a value and not Empty or Nothing, also 'Empty', Null, Nothing violates the Min Max settings - if the user didnt touch it the value returned would be invalid. So you are out of luck on all counts. Perhaps of you told us WHAT you were trying to do... – Ňɏssa Pøngjǣrdenlarp Dec 20 '13 at 16:48
  • Thanks Bjørn For Your Replay – user3123337 Dec 20 '13 at 17:43

1 Answers1

25

You can't make default NumericUpDown control empty. NumericUpDown need a value to increase/decrease from. If 'empty' is only a matter of look empty when user see the form at first, then you can hack it by setting NumericUpDown's Text to empty:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    NumericUpDown1.Text = ""
End Sub

With that NumericUpDown1 will look empty, but NumericUpDown1.Value is still 50.

har07
  • 88,338
  • 12
  • 84
  • 137