Using a nested loop

Discussion created by demdemeleeds on Oct 17, 2011
Latest reply on Oct 18, 2011 by demdemeleeds
I use the following nested loops to read the first point feature of a dataset and the rest points in that dataset. Then read the second point feature of a dataset and the rest points in that dataset and so on. The problem with these nested loops is that it reads the first point and the rest points only once. Why this happens?

    Dim pFCursor As IFeatureCursor
    Set pFCursor = pFeatureClass.Search(Nothing, True)

    Dim pFCursor2 As IFeatureCursor
    Set pFCursor2 = pFeatureClass.Search(Nothing, True)

    Dim pFeature As IFeature
    Dim pFeature2 As IFeature

    Dim pPointA As IPoint
    Dim pPointB As IPoint

    Set pFeature = pFCursor.NextFeature
    Do Until pFeature Is Nothing
    Set pPointA = pFeature.Shape

    MsgBox pFeature.Value(intPosFID) & "F1"

       Set pFeature2 = pFCursor2.NextFeature
       Do Until pFeature2 Is Nothing

             Set pPointB = pFeature2.Shape

             MsgBox pFeature2.Value(intPosFID) & "F2"

       Set pFeature2 = pFCursor2.NextFeature

      Set pFeature = pFCursor.NextFeature