I'm newbie and have question about string builder to show the arcgis layers.(System: ArcGis 10.2, VisualStudio2012)I don't succeed to show the loaded layers in a line of the message box. Plz, can somebody help me?
Thanks a lot in advance!!
code:
Imports ESRI.ArcGIS.GeodatabaseImports ESRI.ArcGIS.CartoImports ESRI.ArcGIS.ArcMapUIImports System.Text
Public Class LayerLoop2_Button1 Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
End Sub
Protected Overrides Sub OnClick()
AccessLayerViaMxDocument(My.ArcMap.Document) My.ArcMap.Application.CurrentTool = NothingEnd SubShared Sub AccessLayerViaMxDocument(ByVal pMxDocument As IMxDocument) Dim pMap As IMap Dim pMaps As IMaps = pMxDocument.Maps Dim i As Integer For i = 0 To pMaps.Count - 1 Step i + 1 pMap = pMaps.Item(i) Debug.WriteLine(pMap.Name) MsgBox(pMap.Name) Dim pEnumLayer As IEnumLayer = pMap.Layers(Nothing, True) pEnumLayer.Reset() Dim pLayer As ILayer = pEnumLayer.Next() Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder() While Not pLayer Is Nothing Debug.WriteLine(pLayer.Name) ' Show MessageBox with the name of the layer pLayer = pEnumLayer.Next() sb.Append(pLayer.Name) MsgBox(sb.ToString()) End While NextEnd Sub
أكثر...
Thanks a lot in advance!!
code:
Imports ESRI.ArcGIS.GeodatabaseImports ESRI.ArcGIS.CartoImports ESRI.ArcGIS.ArcMapUIImports System.Text
Public Class LayerLoop2_Button1 Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
End Sub
Protected Overrides Sub OnClick()
AccessLayerViaMxDocument(My.ArcMap.Document) My.ArcMap.Application.CurrentTool = NothingEnd SubShared Sub AccessLayerViaMxDocument(ByVal pMxDocument As IMxDocument) Dim pMap As IMap Dim pMaps As IMaps = pMxDocument.Maps Dim i As Integer For i = 0 To pMaps.Count - 1 Step i + 1 pMap = pMaps.Item(i) Debug.WriteLine(pMap.Name) MsgBox(pMap.Name) Dim pEnumLayer As IEnumLayer = pMap.Layers(Nothing, True) pEnumLayer.Reset() Dim pLayer As ILayer = pEnumLayer.Next() Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder() While Not pLayer Is Nothing Debug.WriteLine(pLayer.Name) ' Show MessageBox with the name of the layer pLayer = pEnumLayer.Next() sb.Append(pLayer.Name) MsgBox(sb.ToString()) End While NextEnd Sub
أكثر...