Alexander and Neil,
Thanks you both for the suggestions. The following code list the layers in a list box of any selected features. It seems to work but do you see any problems with this approach.
Brian
Public Sub GetLayer()
Dim pMxDoc As IMxDocument
pMxDoc = CType(My.ArcMap.Application.Document, IMxDocument)
Dim pMap As IMap
pMap = pMxDoc.FocusMap
Dim pEnumLayer As IEnumLayer
pEnumLayer = pMap.Layers
pEnumLayer.Reset()
Dim pLayer As ILayer
pLayer = pEnumLayer.Next
Dim pFLayer As IFeatureLayer = Nothing
Do While Not pLayer Is Nothing
If TypeOf pLayer Is IFeatureLayer Then
pFLayer = TryCast(pLayer, IFeatureLayer)
Dim sel As IFeatureSelection
sel = TryCast(pFLayer, IFeatureSelection)
If sel.SelectionSet.Count > 0 Then
ListBox1.Items.Add(pLayer.Name) ' this adds the layer name to a list box
End If
End If
pLayer = pEnumLayer.Next
Loop
End Sub