TextEdit.Value

From Xojo Documentation

Revision as of 23:14, 28 November 2020 by PLefebvre (talk | contribs) (Deprecated in 2020r2.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Property (As String )
aTextEdit.Value = newStringValue
or
StringValue = aTextEdit.Value

New in 2019r2

Supported for all project types and targets.

The text displayed.

Notes

Assigning a string to the Value property replaces the entire contents of the control. The font, size, and color are uniform and match the values last set with the TextFont, TextSize, and TextColor properties, or if these haven't been used, the settings in the IDE.

Please note that the implementation of the TextField and TextArea controls is platform dependent. Do not expect that the text you assign is the same as the text you receive from this property. For example on Mac your text is converted to UTF-8 internally. On Windows all text after a null character (which means chr(0) and not "0") is ignored. End of line characters can change to their platform specific counterpart. Special characters with Asc values below 32 may be ignored or removed.

Sample Code

Clear (remove) any text that is displayed in the TextArea:

TextArea1.Value = ""

This code places the selected text from a TextArea into a TextField.

TextArea1.SelectionStart = 0
TextArea1.SelectionLength = 10

TextField1.Value = TextArea1.SelectedText

If you are using an Integer then you need to convert it to a String:

Var age As Integer
age = Integer.FromString(AgeField.Value)

age = age + 10

AgeField.Value = age.ToString