All 19 Layers from TOC to ComboBox

Discussion created by davisphyllis on Oct 18, 2010
Latest reply on Oct 19, 2010 by davisphyllis
I have a user form that allows someone to view and edit a selected feature. However, I am trying to change this code to allow the user to select a layer from a combo box, then select a unique feature based on it's id, and then edit it's data.

My only problem is I don't know how to add the different layers into the first combobox. I have only ever been able to do this before for just one layer. Any ideas on how to add 18 layers to the combo box? Here is the code I have thus far.

Private Sub SelectFeatures_Click()
'Get GPS Features
Dim pFeatLyr As IFeatureLayer
Set pFeatLyr = GetLayerByTOC("Culvert")
Set pFeatLyr = GetLayerByTOC("Mile Marker")
Set pFeatLyr = GetLayerByTOC("Survey Marker")
Set pFeatLyr = GetLayerByTOC("Sign")
Set pFeatLyr = GetLayerByTOC("Transmission Pole")
Set pFeatLyr = GetLayerByTOC("Turnout")
Set pFeatLyr = GetLayerByTOC("Misc. Points")

Set pFeatLyr = GetLayerByTOC("Barrier")
Set pFeatLyr = GetLayerByTOC("Bridge")
Set pFeatLyr = GetLayerByTOC("Cattle Guard")
Set pFeatLyr = GetLayerByTOC("Chainlink Fence")
Set pFeatLyr = GetLayerByTOC("Curb")
Set pFeatLyr = GetLayerByTOC("Ditch")
Set pFeatLyr = GetLayerByTOC("Ford")
Set pFeatLyr = GetLayerByTOC("Retaining Wall")
Set pFeatLyr = GetLayerByTOC("Spillway")
Set pFeatLyr = GetLayerByTOC("Abandoned Road")
Set pFeatLyr = GetLayerByTOC("Misc. Lines")
Set pFeatLyr = GetLayerByTOC("Misc. Polygons")

'Show form

End Sub

Private Sub UserForm_Initialize()

'Get Improvement Projects FeatureLayer
Dim pFeatLyr As IFeatureLayer
Set pFeatLyr = GetLayerByTOC

'Sort Location combobox
Call SortCboFromFeatLyr(pFeatLyr, "Feature", cboType)

End Sub