NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

UpDownBase Class

Implements the basic functionality required by an up-down control.

Object
   MarshalByRefObject
      MarshalByRefComponent
         Control
            RichControl
               ScrollableControl
                  ContainerControl
                     UpDownBase

[Visual Basic]
MustInherit Public Class UpDownBase
   Inherits ContainerControl
[C#]
public abstract class UpDownBase : ContainerControl
[C++]
public __gc __abstract class UpDownBase : public ContainerControl
[JScript]
public abstract class UpDownBase extends ContainerControl

Remarks

The up-down control consists of a text box and a small vertical scroll bar commonly referred to as a spinner control. The UpDownBase class links the two controls, allow the user to change the display in the text box by clicking the up or down buttons, or entering the appropriate type of value directly into the text box. Use the up-down control in cases where you want to limit the list of values a user may select, similar to a list box or combo box. Depending upon the type of list you wish to display, the advantage to using an up-down control is the that it allows you to quickly set a range of valid values, rather than adding items one at a time. Implementing an up-down control requires less data validation than a text box as you may limit the data type when you derive a class from System.WinForms.UpDownBase.UpDownBase. An example of this is the NumericUpDown class which limits the values to the numeric type and uses a Minimum and Maximum property to validate the data.

To allow the user to use the arrow keys to change the contents of the up-down control set the InterceptArrowKeys property to true. To restrict the user to values you specify, set the ReadOnly property to true. When ReadOnly is true, the user cannot type in a value; they must click the up or down buttons to change the value. To control the alignment of text in the up-down control, set the TextAlign property. To set the alignment of the up and down buttons in relation to the text box portion of the control, set the UpDownAlign property to either LeftRightAlignment.Left or LeftRightAlignment.Right.

The UpButton and DownButton methods, when overridden, handle the clicking of the up or down buttons. When overridden, the methods ValidateEditText and UpdateEditText validate the value(either selected or entered) and update the text displayed in the up-down control. If the value fails validation, use the Select method to select the invalid text. This will allow the user to quickly correct the text by simply typing in a new value without having to manually select or delete the existing text. In a derived class, the OnChanged method raises the System.WinForms.UpDownBase.Changed event when the Text value changes.

Notes to Inheritors: When you inherit from UpDownBase, you must override the following members: DownButton, UpButton, OnChanged, UpdateEditText, ValidateEditText.

Requirements

Namespace: System.WinForms

Assembly: System.WinForms.dll

See Also

UpDownBase Members | System.WinForms Namespace | NumericUpDown | DomainUpDown