Menus and controls that display text and DatePicker controls
The Text property specifies the text displayed in the menu object or control.
If a Menu item has a shortcut key (for example, F1 or Alt+a), Text includes the shortcut key. If the Text property of a Menu item is a single dash (-), the item displays as a separator (a horizontal line the width of the menu), and all other properties for the item are ignored.
In DatePicker controls, the Text property is a read-only property that is equivalent to the Value property with the specified Format or CustomFormat applied. The Text property set for a DatePicker control must be capable of being converted to a DateTime value. This property cannot be set in the painter.
To specify text to be displayed in a Menu item or control:
Enter the desired text in the Text field on the General page of the object’s Properties view.
The Text property takes a string value. The following line
specifies that the text of a check box is Male
:
cb_1.Text = "Male"
The following statements set the Format property to allow a custom format, then set the custom format, then return the text of the DatePicker control to the string variable ls_text:
string ls_text dp_1.Format = dtfCustom! dp_1.CustomFormat = "MMMM dd, yyyy" ls_text = dp_1.text