AnsweredAssumed Answered

VB.Net - Selecting only Polyline layers from the TOC

Question asked by Qu0ta7 on Jan 23, 2018
Latest reply on Jan 24, 2018 by kenbuja

I can successfully get all layers in the TOC into a combo box, but I only want to get layers that are of a polyline geometry in the TOC. My apologies, I do not know the proper method for inserting code here.

 

Protected Overrides Sub OnClick()
        Dim settingsForm As New Settings
        Dim myEnumLayers As ESRI.ArcGIS.Carto.IEnumLayer
        Dim fLayers As ESRI.ArcGIS.Carto.ILayer
        Try
            myEnumLayers = My.ArcMap.Document.FocusMap.Layers
            fLayers = myEnumLayers.Next
            Do Until fLayers Is Nothing
                If fLayers.Valid Then
                    If TypeOf fLayers Is ESRI.ArcGIS.Carto.IFeatureLayer Then
                        settingsForm.ComboBox1.Items.Add(fLayers.Name)
                    End If
                    fLayers = myEnumLayers.Next
                End If
            Loop
        Catch ex As Exception
        End Try
        settingsForm.Show()
  End Sub

Outcomes