ListSourceScriptAddEntries method (WinStudio scripts)

Applies To

IWSFormComponent interface, list source objects

Definition

Inserts entries into a list.

Syntax

object.ListSourceScriptAddEntries( listEntries )

  Part   Description
object Required. A reference to a list source component object.
listEntries Required. A list of type System.Collections.Generic.List(Of String).

Remarks

List source components include these component types:

  • Combo boxes (ComboBox)
  • Drop-down lists (DropList)
  • List boxes (List)
  • Grid columns (GridColumn)

This API must be used from a global script that is referenced in the component's list source, where the list source is of type Script.

Example

In the following example:

  • The first parameter is a form name.
  • The second parameter is the name of a component from which we are loading a list.

Putting this code in the list source for a component of type drop-down list populates the list with a form's components.

Sub Main()
   Dim bListInitialized As Integer
   Dim ComponentNames As New List(Of String)
   Dim FormName As String
   On Error GoTo ErrorHandler
   ReturnValue = "0"
   bListInitialized = 0
   FormName = GetParameter(0).ToString()
   ComponentNames = Application.FormServer.GetFormComponentNames("FormName")
   ThisForm.Components(GetParameter(1)).ListSourceScriptAddEntries(ComponentNames)
   Exit Sub
ErrorHandler:
   Application.ShowMessage("GetComponentList: " & Err.Description)
   ReturnValue = "1"
   Exit Sub
End Sub