Share via


GoTo method

Zooms to the best map view for the specified location.

Applies to

Objects: Location

Syntax

object.GoTo

Parameters

Part

Description

object

Required. An expression that returns a Location object.

Remarks

  • This method was available for use with the Pushpin object in previous versions of MapPoint, but that is now obsolete. See the Obsolete functions topic for more information.

Example

[Microsoft Visual Basic 6.0]
  Sub ZoomToLocation()
  Dim objApp As New MapPoint.Application
  Dim objMap As MapPoint.Map
  Dim objLoc As MapPoint.Location
  'Set up the application
  Set objMap = objApp.ActiveMap
  objApp.Visible = True
  objApp.UserControl = True
  'Get a location, then zoom to the best map view of this location
  Set objLoc = objMap.FindResults("Seattle, WA").Item(1)
  objLoc.GoTo
  End Sub

[C#]
void ZoomToLocation()
{
  MapPoint.ApplicationClass objApp = new MapPoint.ApplicationClass();
  MapPoint.Map objMap = null;
  MapPoint.Location objLoc = null;
  object key = 1;

  //Set up the application
  objMap = objApp.ActiveMap;
  objApp.Visible = true;
  objApp.UserControl = true;

  //Get a location, then zoom to the best map view of this location
  objLoc = (MapPoint.Location) objMap.FindResults("Seattle, WA").get_Item(ref key);
  objLoc.GoTo();

}

Note   This sample code is specifically for use in MapPoint North America; it is for illustration purposes only.