UpDownBase.Text Property

 

Gets or sets the text displayed in the spin box (also known as an up-down control).

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

override Text : string with get, set

Property Value

Type: System.String

The string value displayed in the spin box.

The UpdateEditText method is called if the Text property is set while the UserEdit property is set to true. The ValidateEditText method is called if the Text property is set while the UserEdit property is set to false.

The following code example uses the derived class NumericUpDown. This code requires that a NumericUpDown control and a Button have been created on a form and the System.Drawing namespace has been added as a reference. On the Click event for the button, the point size of text in the NumericUpDown control increases. This prompts the control to adjust its PreferredHeight property so all the text is visible in the control. After the user enters a new value and leaves the NumericUpDown control, the text is converted to a numeric value from a string value and validated to be between the Minimum and Maximum values. If the value is not valid, a MessageBox is displayed with the error, and the Select method will select the text so the user can enter a new value.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: