Hi All,
I'm having a problem with a NumericUpDown control. If the user highlights the number and hits the backspace key the number is, of course, erased. If the user then goes to another control in the dialog box, the number is still not displayed in the NumericUpDown. The value is still there - if the user hits the up or down arrows the number is incremented or decremented and is displayed correctly.
I tried to fix this by declaring a Leave event handler that does something to redraw or otherwise update the NumericUpDown display whenever it looses focus. I first tried using the Refresh() method, but that did nothing. I then tried calling Hide() followed immediately by Show(), and that also did't fix the problem.
Anyone know what I could do to make this work right?
Thanks!
Loading
ScherzoPosted Feb 27, 2012, 10:57 AM
Private Sub MyNumericUpDown_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyNumericUpDown.LostFocus
MyNumericUpDown.Text = MyNumericUpDown.Value
End Sub
So, when the control lost his focus, we always ensure that the .Text have the same value as .Value.
Scherzo
Karl HiramotoPosted Apr 16, 2009, 1:15 PM
To display 123.
http://msdn.microsoft.com/en-us/library/cs40s7ds(VS.85).aspx
Looks like some kind of bug.
Tim ReiterPosted Mar 13, 2008, 8:26 PM
OK, I found that calling UpButton() and then DownButton() seems to work. Does anyone know of a more elegant, less cludgy solution?
Thanks again!