Finds the first layer in the collection occurring after a given starting index.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As LayerCollection
Dim name As String
Dim startIndex As Integer
Dim value As Layer
value = instance.FindByName(name, startIndex) |
Parameters
- name
- Name of layer to find.
- startIndex
- Index of where in the collection to start looking.
Return Value
The first layer in the collection with a given name at or after the starting index, or null if no matching layer is found.
Example
The following example finds a layer by its name in the layer collection, starting at the third position in the collection. The code assumes an existing MapView object.
C# | Copy Code |
---|
// Get the layer collection from a MapView
ESRI.ArcGIS.ADF.IMS.Carto.Layer.LayerCollection mapLayers = mapView.Layers;
string layerName = "CITIES";
ESRI.ArcGIS.ADF.IMS.Carto.Layer.Layer foundLayer;
foundLayer = mapLayers.FindByName(layerName, 2);
if (foundLayer == null)
Label1.Text = "Layer " + layerName + " not found.";
else
Label1.Text = "Layer " + layerName + ": ID is " + foundLayer.ID; |
Visual Basic | Copy Code |
---|
' Get the layer collection from a MapView
Dim mapLayers As ESRI.ArcGIS.ADF.IMS.Carto.Layer.LayerCollection
mapLayers = mapView.Layers
Dim layerName As String = "CITIES"
Dim foundLayer As ESRI.ArcGIS.ADF.IMS.Carto.Layer.Layer
foundLayer = mapLayers.FindByName(layerName, 2)
If IsNothing(foundLayer) Then
Label1.Text = "Layer " + layerName + " not found."
Else
Label1.Text = "Layer " + layerName + ": ID is " + foundLayer.ID
End If |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also