BUG: The value in the NumericUpDown control does not reset to the maximum or minimum value if you use the TAB key or mouse to shift focus (814347)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

Beta Information

This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.

No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location from which you downloaded the release.

SYMPTOMS

The value in the NumericUpDown control does not reset to the maximum value if you type a value that is greater than the maximum value of a NumericUpDown control, and then press the TAB key or use a mouse to shift focus. Similarly, when you type a value that is less than the minimum value of the NumericUpDown control, the value does not reset to minimum value. If you press the ENTER key in the NumericUpDown control, the maximum value or minimum value is set.

CAUSE

When you type text in the NumericUpDown control, the Text property of the control is set to the new value. When you press the TAB key or use a mouse to shift your focus, the Value property of the control does not change. The Value property of the control continues to hold the previous value. Therefore, the value in the control does not change. When you use the Value property in code or you press the ENTER key in the control, the Value property is set to the text that you type. The new value is validated between the minimum and maximum values.

RESOLUTION

To work around this bug, add sample code to access the Value property in the validating or validated event for NumericUpDown. For example, add the following code in the NumericUpDown1 validating or validated event:

Visual Basic .NET
Console.WriteLine(NumericUpDown1.Value)
Visual C# .NET
Console.WriteLine(numericUpDown1.Value);

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION


Steps to Reproduce the Behavior

  1. Open Visual Basic .NET.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types, click to select Visual Basic projects or Visual C# projects.
  4. Under Templates, click to select Windows Application.

    By default, Form1 is created.
  5. From the toolbox, drag the NumericUpDown control to Form1.

    NumericUpDown1 is created.
  6. Right-click NumericUpDown1, and then click Properties.
  7. In the Properties window, locate the Minimum property and the Maximum property.

    By default, the values for these properties are set to 0 and 100, respectively.
  8. From the toolbox, drag a TextBox control to Form1.
  9. On the Debug menu, click Start.

    By default, the focus is on NumericUpDown1.
  10. Type a value greater than 100.
  11. Press the TAB key or click Textbox1 to shift focus.

    The value in NumericUpDown1 does not change to 100.

REFERENCES

For more information, see your Microsoft .NET Framework SDK Documentation or visit the following MSDN Web site:

NumericUpDown Control (Windows Forms)
http:// msdn.microsoft.com/library/en-us/vbcon/html/vborinumericupdownctltasks.asp

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbProperties kbValidation kbTabCtrl kbControl kbbug KB814347 kbAudDeveloper