FindResults method

MapPoint North America 2006 SDK

Returns a collection of locations and Pushpins (FindResults collection) that are possible place and address find matches based on the input string; similar to the Find box on the Navigation toolbar.

Applies to

Objects:  Map

Syntax

object.FindResults(Name)

Parameters

Part Description
object Required. An expression that returns a Map object.
Name Required String. The name of the place or address to find.

Remarks

To return an assessment of how well the results produced by the FindResults 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 you know the input is an address, use the FindAddressResults method on the Map to return only addresses. Likewise, if you know the input string is a place, use the FindPlaceResults method on the Map object to return only places.

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 FindResultsSearch()
  Dim objApp As New MapPoint.Application   Dim objFindResults As MapPoint.FindResults

  'Set up application   objApp.Visible = True   objApp.UserControl = True
  'Output first result of find search   Set objFindResults = objApp.ActiveMap.FindResults("Seattle, WA")   MsgBox "The first item in the find list is: " _     + objFindResults.Item(1).Name
  End Sub

[C#]
void FindResultsSearch() { MapPoint.ApplicationClass objApp = new MapPoint.ApplicationClass(); MapPoint.FindResults objFindResults = null; MapPoint.Location objLoc = null; object key = 1; //Set up the application objApp.Visible = true; objApp.UserControl = true; //Output the first result of find search objFindResults = (MapPoint.FindResults)objApp.ActiveMap.FindResults("Seattle, WA"); objLoc = (MapPoint.Location)objFindResults.get_Item(ref key); //A reference to System.Windows.Forms.dll is needed //to show the MessageBox System.Windows.Forms.MessageBox.Show( "The first item in the find list is: " + objLoc.Name.ToString()); }

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

Show: