リレート フィーチャの取得

IRelationshipClassCollection pRelationshipClassCollection = pLayer;
IEnumRelationshipClass pEnumRelationshipClass = pRelationshipClassCollection.RelationshipClasses;
pEnumRelationshipClass.Reset();

IRelationshipClass pRelationshipClass = pEnumRelationshipClass.Next();
ISet pSet1 = pRelationshipClass.GetObjectsRelatedToObject(pFeature); //pFeatureはリレート元のフィーチャ
pSet1.Reset();

IFeature pFeature1 = pSet1.Next();
Dim pRelationshipClassCollection As IRelationshipClassCollection = pLayer
Dim pEnumRelationshipClass As IEnumRelationshipClass = pRelationshipClassCollection.RelationshipClasses
pEnumRelationshipClass.Reset()

Dim pRelationshipClass As IRelationshipClass = pEnumRelationshipClass.Next()
Dim pSet1 As ISet = pRelationshipClass.GetObjectsRelatedToObject(pFeature) 'pFeatureはリレート元のフィーチャ
pSet1.Reset()

Dim pFeature1 As IFeature = pSet1.Next()
Public Sub test()
    '現在のドキュメントを取得
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
    
    'アクティブなデータフレームの取得
    Dim pMap As IMap
    Set pMap = pMxDocument.FocusMap
    
    'レイヤを取得
    Dim pLayer As ILayer
    Set pLayer = pMap.Layer(1)
'    Set pLayer = pMap.Layer(InputBox("Layer Index ?"))
    
    'フィーチャレイヤを取得
    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pLayer
    
    Dim pFeatureClass As IFeatureClass
    Set pFeatureClass = pFeatureLayer.FeatureClass
    
    Dim pFeature As IFeature
    Set pFeature = pFeatureClass.GetFeature(2)
    Debug.Print pFeature.Value(3)

    
    
    Dim pRelationshipClassCollection As IRelationshipClassCollection
    Set pRelationshipClassCollection = pLayer
  
    Dim pEnumRelationshipClass As IEnumRelationshipClass
    Set pEnumRelationshipClass = pRelationshipClassCollection.RelationshipClasses
    pEnumRelationshipClass.Reset
    
    Dim pRelationshipClass As IRelationshipClass
    Set pRelationshipClass = pEnumRelationshipClass.Next
    
    Dim pSet1 As ISet
    Set pSet1 = pRelationshipClass.GetObjectsRelatedToObject(pFeature)
    pSet1.Reset
    
    Dim pFeature1 As IFeature
    Set pFeature1 = pSet1.Next
    
    Debug.Print pFeature1.Value(3)

End Sub