属性テーブルのソート順でレコードを取得

投稿日:2016/9/1 (木) 更新日:

'属性テーブルのソート順でレコードを取得
Sub GetSortedRows()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
     
    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pMxDocument.FocusMap.Layer(0)
     
    Dim pTableWindow  As ITableWindow
    Set pTableWindow = New TableWindow
     
    Dim pTableWindow3 As ITableWindow3
    Set pTableWindow3 = pTableWindow
     
    Set pTableWindow.Application = Application
    Set pTableWindow.FeatureLayer = pFeatureLayer
     
    If pTableWindow.IsVisible = False Then
        pTableWindow.Show (True)
    End If
     
    Dim pExistingTableWindow As ITableWindow
    Set pExistingTableWindow = pTableWindow3.FindViaLayer(pFeatureLayer)
     
    Dim pTableControl As ITableControl3
    Set pTableControl = pExistingTableWindow.TableControl
     
    Dim i As Long
    For i = 1 To pExistingTableWindow.FeatureLayer.FeatureClass.FeatureCount(Nothing)
        Call pTableControl.SetCurrentRow(False, i)
        Debug.Print "i:" & i, "OID:" & pTableControl.GetCurrentRow(True)
         
    Next i
 
End Sub

関連記事

-プログラミング, ArcGIS
-, ,

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.