ISList.Exchange

Description

This function reverses the positions of the objects in the list.

Syntax

object.Exchange aIndex1, aIndex2

Part Attribute Type Description
object Required
The object always implements the ISList interface
aIndex1 In, Required
int
The index of the object in the list
aIndex2 In, Required
int
The index of the object in the list

Example

Fill in the list with the user-selected patients and display the patients in the list before and after the change.

Dim aList
Dim aPatient
Dim aMessage
Dim aIndexof
Dim i

Set aList = Profile.CreateList

const aPatientCount = 2
for i = 0 to aPatientCount - 1 
  set aPatient = Profile.SelectPatient
  aList.Add(aPatient)
next

aMessage = "The patients in the list before the change: " &  aList.Count
for i = 0 to aList.Count - 1 
  set aPatient = aList.Item(i)
  aIndexof = aList.IndexOf(aPatient)
  aMessage = aMessage & vbNewLine & " - " & aPatient.SurnameFirstName & " (" &_
    aIndexof & ")"
next

aList.Exchange 0, 1
aMessage = aMessage & vbNewLine & "The patients in the list after the change: "
for i = 0 to aList.Count - 1 
  set aPatient = aList.Item(i)
  aIndexof = aList.IndexOf(aPatient)
  aMessage = aMessage & vbNewLine & " - " & aPatient.SurnameFirstName & " (" &_
    aIndexof & ")"
    next
Profile.MsgBox(aMessage) 
Note:

Version information

Added in v7.8.0