How to display selected features in Identify Dialog

Discussion created by katie_gaut on Apr 17, 2014
Latest reply on Apr 22, 2014 by katie_gaut
    I'm brand new to ArcObjects SDKs and am struggling. I have a Python Add-in performing a query to select records (works great)and now trying to call the identify dialog via an .NET addin button that displays the identify dialog box to show attributes of the selected records.  Below is the code I have at this point.  I currently have the identify dialog displaying, but no records appearing. I know I need to input the selected records somewhere....but not sure where.   Any thoughts would be appreciated.  (I'm using Visual Studio/Microsoft Visual Basic 2010 and ArcGIS 10.2.1)

Imports ESRI.ArcGIS.ArcMapUI
Imports ESRI.ArcGIS.Carto

Public Class Identify_Button
    Inherits ESRI.ArcGIS.Desktop.AddIns.Button
    Dim pMxDoc As IMxDocument

    Dim activeView As IMap

    Public Sub DoIdentify(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal x As System.Int32, ByVal y As System.Int32)
        pMxDoc = My.ArcMap.Application.Document
        activeView = pMxDoc.FocusMap
        If activeView Is Nothing Then
        End If

        Dim map As ESRI.ArcGIS.Carto.IMap = activeView.FocusMap
        Dim identifyDialog As ESRI.ArcGIS.CartoUI.IIdentifyDialog = New ESRI.ArcGIS.CartoUI.IdentifyDialogClass
        identifyDialog.Map = map

        'Clear the dialog on each mouse click
        Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay = activeView.ScreenDisplay

        Dim display As ESRI.ArcGIS.Display.IDisplay = screenDisplay ' Implicit Cast
        identifyDialog.Display = display

        Dim identifyDialogProps As ESRI.ArcGIS.CartoUI.IIdentifyDialogProps = CType(identifyDialog, ESRI.ArcGIS.CartoUI.IIdentifyDialogProps) ' Explicit Cast
        Dim enumLayer As ESRI.ArcGIS.Carto.IEnumLayer = identifyDialogProps.Layers

        Dim layer As ESRI.ArcGIS.Carto.ILayer = enumLayer.Next

        Do While Not (layer Is Nothing)
            identifyDialog.AddLayerIdentifyPoint(layer, x, y)
            layer = enumLayer.Next()


    End Sub
    Public Sub New()

    End Sub

    Protected Overrides Sub OnClick()
        DoIdentify(activeView, 300, 100)
    End Sub

    Protected Overrides Sub OnUpdate()
        Enabled = My.ArcMap.Application IsNot Nothing
    End Sub

End Class