Share via


FindPlaceResults method

Returns a collection of locations and Pushpins (FindResults collection) that are possible find matches based on the input string; similar to using the Place tab on the Find dialog box.

Applies to

Objects: Map

Syntax

object.FindPlaceResults(Name)

Parameters

Part

Description

object

Required. An expression that returns a Map object.

Name

Required String. The name of the place to find.

Remarks

  • To return an assessment of how well the results produced by the FindPlaceResults method match the Name parameter, use the ResultsQuality property of the FindResults collection, or check the Type, StreetAddress, or PlaceCategory property of a Location object.

  • If the input is a place name that MapPoint might interpret as an address (for example "Club Easy Street"), the results will be ambiguous. Therefore, if you are not sure whether the input is a place name or an address, it is a good idea to use multiple methods—the FindResults, FindAddressResults, and FindPlaceResults methods—and then compare the results.

  • To open the Find dialog box for user input, use the ShowFindDialog method on the Map object.

Example

[Microsoft Visual Basic 6.0]
Sub FindPlaces()
    Dim oApp As MapPoint.Application
    Dim oMap As MapPoint.Map

    Set oApp = CreateObject("MapPoint.Application")
    Set oMap = oApp.ActiveMap
    oApp.UserControl = True
    oApp.Visible = True

    oMap.AddPushpin oMap.FindPlaceResults("Washington, D.C.")(1)
    oMap.AddPushpin oMap.FindPlaceResults("Mount Rushmore")(1)
End Sub

[C#]
void FindPlaces()
{
 MapPoint.Application objApp = new MapPoint.Application();
 MapPoint.Map objMap = null;
 MapPoint.Location objLoc1 = null;
 MapPoint.Location objLoc2 = null;
 object key = 1;

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

 //Get locations
 objLoc1 = (MapPoint.Location) objMap.FindPlaceResults("Washington, D.C.").get_Item(ref key);
 objLoc2 = (MapPoint.Location) objMap.FindPlaceResults("Mount Rushmore").get_Item(ref key);


 objMap.AddPushpin(objLoc1,objLoc1.Name.ToString());
 objMap.AddPushpin(objLoc2,objLoc2.Name.ToString());

 }

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