InvalidateList method (WinStudio scripts)
Applies To
IWSFormComponent interface
Definition
Marks the list associated with a list source component as invalid.
Syntax
object.InvalidateList
Part | Description |
object | Required. A reference to a list source component object. |
Remarks
Calling this method guarantees that the list in a list source component will be reconstructed the next time the user accesses the list. List source components include the following component types:
- Combo boxes (ComboBox)
- Drop-down lists (DropList)
- List boxes (List)
- Grid columns (GridColumn)
In list boxes, this method reverts the list to its original state.
Example
Sub Main()
Dim oListBox As IWSFormComponent
Dim iCurrentRow As Integer
Dim iCounter As Integer
Dim strListBox As String
Dim bSuccess As Boolean
Dim iReturn As Integer
Dim iRow As Integer
oListBox = ThisForm.Components("list1")
'Check to verify that a list item is selected.
'If not, display a message and exit.
iCurrentRow = oListBox.GetListBoxCurSel
If iCurrentRow = -1 Then
Application.ShowMessage("No list item selected!")
Exit Sub
End If
'Display list box properties.
Application.ShowMessage("Number of items: " & oListBox.GetListBoxCount().ToString() _
& vbLf & "Current selection: " & (iCurrentRow + 1).ToString() & vbLf & _
"Text: " & oListBox.GetListBoxText(iCurrentRow))
'Display contents of list box.
strListBox = ""
For iCounter = 0 To oListBox.GetListBoxCount() - 1
strListBox = strListBox & (iCounter + 1).ToString() & " " & _
oListBox.GetListBoxText(iCounter) & vbLf
Next iCounter
Application.ShowMessage("The following are the currently defined events:" _
& vbLf & strListBox)
'Set list box to second entry.
iRow = 1
bSuccess = oListBox.SetListBoxCurSel(iRow)
'Insert new items at the second position.
iReturn = oListBox.InsertListBoxString(iRow, "New Row Entry 1")
iReturn = oListBox.InsertListBoxString(iRow, "New Row Entry 2")
'Display contents of list box.
strListBox = ""
For iCounter = 0 To oListBox.GetListBoxCount() - 1
strListBox = strListBox & (iCounter + 1).ToString() & " " & _
oListBox.GetListBoxText(iCounter) & vbLf
Next iCounter
Application.ShowMessage("Current list: " & vbLf & strListBox)
oListBox.InvalidateList()
End Sub