First method (WinStudio scripts)

Applies To

IWSIDOCollection interface

Definition

Navigates to the first object in a specified IDO collection (the top entry) and returns a Boolean value indicating whether the navigation was successful.

Syntax

object.First( )

  Part   Description
object Required. A reference to an IDO collection object.

Remarks

A return value of:

  • TRUE indicates that the system navigated to the first object in the collection, and the index of the IDO collection was reset to 0.
  • FALSE indicates that the system did not navigate to the first object, and the index was not reset.

This method navigates objects in the IDO collection but does not set the focus of the form to the first object.

Example

This example assumes you are using a form with both primary and secondary collections. It navigates to the first record, first on the primary collection, and then on the secondary collection, both times displaying the same message afterward (assuming the navigation is successful in both cases).

注意:You can tell that the navigation has been successful also by watching the current row indicator (pointer) for each collection.
Sub Main()
   Dim oCache As IWSIDOCollection
   oCache = ThisForm.CurrentIDOCollection
   If oCache.First() Then
      Application.ShowMessage("The system navigated to the first record." _
         & vbLf & "The index number is now: " & _
         oCache.GetCurrentObjectIndex())
   Else
      Application.ShowMessage("Navigation failed!")
   End If
   ThisForm.CurrentIDOCollection = ThisForm.GetSecondaryIDOCollection(2)
   oCache = ThisForm.CurrentIDOCollection
   If oCache.First() Then
      Application.ShowMessage("The system navigated to the first record." _
         & vbLf & "The index number is now: " & _
         oCache.GetCurrentObjectIndex())
   Else
      Application.ShowMessage("Navigation failed!")
   End If
End Sub