Example for component object

Applies To

WinStudio scripts:

  • Caption property
  • Label property
  • Name property
  • Text property

Example

Sub Main()
   Dim oCache As IWSIDOCollection
   Dim oComponent As IWSFormComponent
   'Set a variable to a grid's IDO collection.
   oCache = ThisForm.Components("grid1").IDOCollection
   Application.ShowMessage("Number of rows: " & oCache.GetNumEntries _
      & vbLf & "Current Row: " & oCache.GetCurrentObjectIndex() + 1)
   'Set a variable to a component.
   oComponent = ThisForm.Components("gridColumn1")
   Application.ShowMessage("Name: " & oComponent.Name & vbLf & _
      "Caption: " & oComponent.Caption & vbLf & _
      "Text: " & oComponent.Text & vbLf & _
      "Label: " & oComponent.Label)
   oComponent.Caption = "New Caption"
   oComponent.Text = "New Value"
   Application.ShowMessage("Name: " & oComponent.Name & vbLf & _
      "Caption: " & oComponent.Caption & vbLf & _
      "Text: " & oComponent.Text & vbLf & _
      "Label: " & oComponent.Label)
End Sub
Related topics