property Items.NextVisibleItem (Index as Long) as Long
Retrieves the index of next visible item.

TypeDescription
Index as Long A long expression that indicates the index of the item.
Long A long expression that indicates the next visible item's index

The NextVisibleItem property retrieves -1 if there is no next visible item. Use the FirstVisibleItem and NextVisibleItem properties to enumerate the items as they are listed. The LastVisibleItem property retrieves the index of last item that fits the client area. Use the PrevVisibleItem property to get the previous item. Use the SortOrder property to sort a column. Use the ItemPosition property to change the item's position. Use the ItemFromPoint property to get the item from cursor. Use the GetItems property to get the list of items.

The following VB sample displays the items as they are listed:

With List1.Items
    Dim i As Long
    i = .FirstVisibleItem
    While (i >= 0)
        Debug.Print .Caption(i, 0)
        i = .NextVisibleItem(i)
    Wend
End With

The following C++ sample displays the items as they are listed:

CItems items = m_list.GetItems();
long i = items.GetFirstVisibleItem();
while ( i >= 0 )
{
	CString strCaption = V2S( &items.GetCaption( i, COleVariant( long(0) ) ) );
	OutputDebugString( strCaption );
	i = items.GetNextVisibleItem( i );
}

The following VB.NET sample displays the items as they are listed:

With AxList1.Items
    Dim i As Integer = .FirstVisibleItem
    While (i >= 0)
        Debug.WriteLine(.Caption(i, 0))
        i = .NextVisibleItem(i)
    End While
End With

The following C# sample displays the items as they are listed:

int i = axList1.Items.FirstVisibleItem;
while (i >= 0)
{
	object cell = axList1.Items.get_Caption(i, 0);
	System.Diagnostics.Debug.WriteLine(cell != null ? cell.ToString() : "");
	i = axList1.Items.get_NextVisibleItem(i);
}

The following VFP sample displays the items as they are listed:

With thisform.List1.Items
    local i
    i = .FirstVisibleItem
    do While (i >= 0)
        wait window .Caption(i, 0)
        i = .NextVisibleItem(i)
    enddo
EndWith