Text property (WinStudio scripts)

Applies To

IWSFormComponent interface

Definition

Sets or returns a string containing the value of an editable component.

If the component is bound to a property, then setting its value updates the property, marks the property modified, and notifies other dependents on the property (such as other components bound to it) to refresh.

Set Syntax

object.Text = string

  Part   Description
object Required. A reference to an editable component object.
string Required. The new value to be assigned to the component.

Get Syntax

object.Text

  Part   Description
object Required. A reference to an editable component object.

Remarks

WinStudio stores the values of editable components as character strings.

In a tree component, this property returns the value of the first property in the current node.

With the exception of how date and numeric formats are presented, this property is the same as the TextInternal property. For instance, with this property, dates are presented using the current locale display format. With the TextInternal property, the date is presented using the WinStudio internal date format.

Examples

For a form:

Sub Main()
   Dim oComponent As IWSFormComponent
   Dim value1 As String
   Dim value2 As String
         
   'Show current field values: 
   oComponent = ThisForm.Components("FirstGridCol")
   value1 = oComponent.Text
   value2 = ThisForm.Components("SecondGridCol").Text
   Application.ShowMessage("First column value: " _
      & value1 & vbLf & "Second column value: " _
      & value2)
   
   'Swap values and display confirmation message:
   oComponent.Text = value2
   ThisForm.Components("SecondGridCol").Text = value1
   Application.ShowMessage("The text should now be swapped!")
End Sub

For a component object, see Example for component object.

相关主题