Share via


MoveToPushpin method

Sets the current record of the record set to the record for the given Pushpin. This allows access to any imported data associated with that Pushpin through the Fields collection of the Recordset object. If the Pushpin is not in the Recordset object, the Recordset points to the EOF property. Fails for DataSet objects with a DataMapType property of geoDataMapTypeTerritory.

Applies to

Objects: Recordset

Syntax

object.MoveToPushpin(Pushpin)

Parameters

Part

Description

object

Required. An expression that returns a Recordset object.

Pushpin

Required Pushpin object. Pushpin to which the record is moved.

Remarks

Example

[Microsoft Visual Basic 6.0]
Sub PointRecordsetToPin()

Dim objApp As New MapPoint.Application
Dim objPin As MapPoint.Pushpin
Dim objRS As MapPoint.Recordset
objApp.Visible = True
objApp.UserControl = True

'Find a Pushpin
Set objPin = objApp.OpenMap(objApp.Path & "\Samples\Clients.ptm").FindPushpin("Jo Berry Coho Vineyard")

'Get all records for this Pushpin's data set
Set objRS = objPin.Parent.QueryAllRecords

'Point the record set to the Pushpin and zoom to it
objRS.MoveToPushpin objPin
objRS.Location.GoTo

End Sub

[C#]
void PointRecordsetToPin()
{
  MapPoint.ApplicationClass objApp = new MapPoint.ApplicationClass();
  MapPoint.Map objMap = null;
  MapPoint.Pushpin objPin = null;
  MapPoint.Recordset objRS = null;
  object key = 1;

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

  //Find a Pushpin
  objMap = objApp.OpenMap(objApp.Path + "\\Samples\\Clients.ptm", false);
  objPin = (MapPoint.Pushpin) objMap.FindPushpin("Jo Berry Coho Vineyard");

  //Get all records for this Pushpin's data set
  objRS = (MapPoint.Recordset) objPin.Parent.QueryAllRecords();

  //Point the record set to the Pushpin and zoom to it
  objRS.MoveToPushpin(objPin);
  objRS.Location.GoTo();
}