NumericUpDown Control [modified]
-
Hi, I'm using a NumericUpDown control (C# .NET 2.0 Windows Form) so user can enter a quantity value. After the WinForm's data is saved, I want to reset the NumbericUpDown control to it's default value (1). Using this code works if any value is in the box: numericUpDown_Quantity.Value = 1; but if the user removes all text (values) from the NumericUpDown box, it does not paste the 1 back into the box. The value has updated in memory (if you click UP, the next value is 2), but the box still shows empty. I've tried: numericUpDown_Quantity.Update(); numericUpDown_Quantity.Refresh(); numericUpDown_Quantity.ResetText(); Any help would be appreciated. Thanks, Ron -- modified at 18:02 Sunday 18th March, 2007
-
Hi, I'm using a NumericUpDown control (C# .NET 2.0 Windows Form) so user can enter a quantity value. After the WinForm's data is saved, I want to reset the NumbericUpDown control to it's default value (1). Using this code works if any value is in the box: numericUpDown_Quantity.Value = 1; but if the user removes all text (values) from the NumericUpDown box, it does not paste the 1 back into the box. The value has updated in memory (if you click UP, the next value is 2), but the box still shows empty. I've tried: numericUpDown_Quantity.Update(); numericUpDown_Quantity.Refresh(); numericUpDown_Quantity.ResetText(); Any help would be appreciated. Thanks, Ron -- modified at 18:02 Sunday 18th March, 2007
You tried everything, except setting the controls Text property, which is sperate from it's Value property.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
You tried everything, except setting the controls Text property, which is sperate from it's Value property.
Dave Kreskowiak Microsoft MVP - Visual Basic
Thanks Dave, I didn't realize I could use the Text property becuase it's not listed in IntelliSense. It works great... I'm not sure why it's not listed in IntelliSense. I've noticed that if the Up or Down buttons are used, this problem does not occur. Only if the user deletes the text before Up/Down does Value=1 not work. Ron
-
Thanks Dave, I didn't realize I could use the Text property becuase it's not listed in IntelliSense. It works great... I'm not sure why it's not listed in IntelliSense. I've noticed that if the Up or Down buttons are used, this problem does not occur. Only if the user deletes the text before Up/Down does Value=1 not work. Ron
Yeah, that's why I do my research in the documentation instead of Intellisense. There's lots of hidden stuff in the docs that you'll never see anywhere else.
Dave Kreskowiak Microsoft MVP - Visual Basic