I'm doing a vb.net button to run in ARCGIS. the button is working, the problem is as I'm working in the layot when I press the button, change the layout coordinates and the map coordinates. Is a way that the layout view don't move and keep the Coordinates (0,0)

I leave the code:

MxDoc = My.ArcMap.Document

ActiveView = MxDoc.ActiveView

Dim x As Double = txtEast.Text

Dim y As Double = txtNorth.Text

Map.MapScale = 4000 'zoom to this scale

Envelope = ActiveView.Extent

,Create and Add the point coordinates
Point = New ESRI.ArcGIS.Geometry.Point
Point.PutCoords(x, y)

'Envelope Position go to the middle of the point

'Refresh View
 ActiveView.Extent = Envelope
 MxDoc.ActiveView.Refresh()Map = MxDoc.FocusMap

Thank You!


Instead of setting the ActiveView to MxDoc.ActiveView, which could be either an IMap or IPageLayout, set it to MxDoc.FocusMap


What changes did you make to you code? This code will move the map but not the layout

        Dim pMap As ESRI.ArcGIS.Carto.IMap = My.ArcMap.Document.FocusMap
        Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView = pMap
        Dim pEnvelope As ESRI.ArcGIS.Geometry.IEnvelope = pActiveView.Extent
        Dim pPoint As New ESRI.ArcGIS.Geometry.Point

        pPoint.PutCoords(x, y)

        pActiveView.Extent = pEnvelope
        pMap.MapScale = 4000
  • Thank you, but it still doesn't work, the layout is still moving. – TitoGIS Dec 13 '12 at 22:15
  • It breaks when I change the activeview to Map... the problem is that I have to work in the layout view. I think that after do my command I should do "zoom to whole page", but I don't have any idea how to connect it. By the way, thank you very much! – TitoGIS Dec 14 '12 at 16:04
  • I've tested this code while in layout view and it works properly. Can you post the new code you're using? – kenbuja Dec 14 '12 at 16:46
  • Hello again... now I don't know why is working, instead to modify my code I just copy yours and works. Thank Very much! – TitoGIS Dec 15 '12 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.