Public Overrides Sub OnCreate(ByVal hook As Object) If Not hook Is Nothing Then m_application = CType(hook, IApplication) 'Disable if it is not ArcMap If TypeOf hook Is IMxApplication Then MyBase.m_enabled = True Else MyBase.m_enabled = False End If End If ' TODO: Add other initialization code End Sub
Public Function GetLayer(ByVal sLayer) As ILayer Dim pMxDoc As IMxDocument Dim i As Integer Dim players As IEnumLayer Dim pLayer As ILayer Dim pL As ILayer Dim ii As Integer Dim pCL As ICompositeLayer pMxDoc = m_application.Document On Error GoTo GetLayer_Err players = pMxDoc.FocusMap.Layers(, True) End If pLayer = players.Next Do While Not pLayer Is Nothing If TypeOf pLayer Is ICompositeLayer Then pCL = pLayer For ii = 0 To pCL.Count - 1 pL = pCL.Layer(ii) If UCase(pL.Name) = UCase(sLayer) Then GetLayer = pL Exit Function End If Next Else If UCase(pLayer.Name) = UCase(sLayer) Then GetLayer = pLayer Exit Function End If End If pLayer = players.Next Loop Exit Function GetLayer_Err: End Function
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.