Caption property

From Xojo Documentation

Revision as of 19:11, 12 February 2021 by PLefebvre (talk | contribs) (Controls implementing the Caption property: Removed Label as its Caption property was deprecated some time ago)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Property (As String )
aControl.Caption = newStringValue
or
StringValue = aControl.Caption

Supported for all project types and targets.

The caption of a control.

Notes

This property can be set inside the IDE or programmatically.

To set an accelerator character, precede the character in the Caption with an ampersand. In order to show an ampersand in the Caption, use two ampersands in a row.

Controls implementing the Caption property

BevelButton
Checkbox
DataControl
GroupBox
PushButton
RadioButton
ToolItem

Sample Code

This code sets the caption of the control to "OK".

Me.Caption = "OK"

This code in the Action event handler for a PushButton changes the text of the button each time it is clicked:

If Me.Caption = "Blue" Then
Me.Caption = "Red"
Else
Me.Caption = "Blue"
End If