Hi, I am not too sure of what problem you are exactly facing, but I guess this might help. This code joins layer to layerReferring this one might also helphttp://forums.esri.com/Thread.asp?c=93&f=992&t=97996&mc=3#msgid274992Regards,Priyanka
Dim pFeatLayer As IFeatureLayer Dim pFeatLayerjn As IFeatureLayer Dim pDispTable As IDisplayTable Dim pFCLayer As IFeatureClass Dim pTLayer As ITable Dim pActiveView As IActiveView pMxDoc = My.ArcMap.Document pMap = pMxDoc.FocusMap pActiveView = pMap pMap.ClearSelection() pActiveView.Refresh() Dim pTLayer2 As ITable If pMap.LayerCount < 2 Then MsgBox("Must have at least two layer", MsgBoxStyle.Information) Exit Function End If ''''''''''''''''*****************************'''''''''''''''''''''''''' pFeatLayerjn = FindLayerByName(pMap, LayerName) If pFeatLayerjn Is Nothing Then MsgBox("Could not find Layer " & LayerName & "for joining", MsgBoxStyle.Exclamation) Exit Function End If pDispTable = pFeatLayerjn pFCLayer = pDispTable.DisplayTable pTLayer = pFCLayer pFeatLayer = pMap.Layer(0) pDispTable = pFeatLayer pFCLayer = pDispTable.DisplayTable pTLayer2 = pFCLayer Dim strJnField As String Dim JnField2 As String strJnField = joinfield1 ''''''' FID JnField2 = joinfield2 ''''''' PntName ' Create virtual relate Dim pMemRelFact As IMemoryRelationshipClassFactory Dim pRelClass As IRelationshipClass pMemRelFact = New MemoryRelationshipClassFactory pRelClass = pMemRelFact.Open("LayertoLayer", pTLayer2, strJnField, pTLayer, JnField2, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToOne) ' use Relate to perform a join Dim pDispRC As IDisplayRelationshipClass pDispRC = pFeatLayer pDispRC.DisplayRelationshipClass(pRelClass, esriJoinType.esriLeftOuterJoin) MsgBox("Fields Joined", MsgBoxStyle.Information)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.