WinStudio

Caption Property

Applies To

Definition

Sets or returns a string that is the caption of the form or the label of the component.

Get Syntax

object.Caption

  Part

  Description

object Required. A reference to a form or form component object.

Set Syntax

object.Caption = "string"

  Part

  Description

object Required. A reference to a form or form component object.
string Required. The caption of the form or the label of the component.

Remarks

In the Get syntax, the return value is the string being used as the caption or label.

Example for Form Objects

Sub Main()
   Dim myCaption As String
   myCaption = ThisForm.Caption
   Application.ShowMessage("The current caption for this form is " & myCaption & ".")
   ThisForm.Caption = "My Own Form"
   myCaption = ThisForm.Caption
   Application.ShowMessage("The new caption for this form is " & myCaption & ".")
End Sub 

Example for Component Objects