Share via


FindAddressResults method

Finds a collection of locations that are possible matches to an address; similar to using the Address tab on the Find dialog box. Although the parameters are each optional, you must pass at least one parameter. If a parameter is not supported for an address—for example, Region for an address in Germany—the parameter is ignored. Returns a FindResults collection.

Applies to

Objects:  Map

Syntax

object.FindAddressResults([Street], [City], [OtherCity], [Region], [PostalCode], [Country])

Parameters

Part Description
object Required. An expression that returns a Map object.
Street Optional String. The street name or street address to find.
City Optional String. The name of the city to find.
OtherCity Optional String. The name of the second city to find. Valid only for addresses in the United Kingdom.
Region Optional String. The name of the region to find, as follows:

the province name for addresses in Canada

the region name for addresses in Italy

the autonomia name for addresses in Spain

the constituent country name for addresses in the United Kingdom

the state name for addresses in the United States

PostalCode Optional String. The postcode, postal code, or ZIP Code to find.
Country Optional GeoCountry. The country to find. The following GeoCountry values are valid for the FindAddressResults method:
GeoCountry Description Version
geoCountryAustria Austria MapPoint Europe
geoCountryBelgium Belgium MapPoint Europe
geoCountryCanada Canada MapPoint North America
geoCountryDenmark Denmark MapPoint Europe
geoCountryFinland Finland (Helsinki) MapPoint Europe
geoCountryFrance France MapPoint Europe
geoCountryGermany Germany MapPoint Europe
geoCountryItaly Italy MapPoint Europe
geoCountryLuxembourg Luxembourg MapPoint Europe
geoCountryNetherlands Netherlands MapPoint Europe
geoCountryNorway Norway (Oslo area) MapPoint Europe
geoCountryPortugal Portugal MapPoint Europe
geoCountrySpain Spain MapPoint Europe
geoCountrySweden Sweden MapPoint Europe
geoCountrySwitzerland Switzerland MapPoint Europe
geoCountryUnitedKingdom United Kingdom MapPoint Europe
geoCountryUnitedStates United States MapPoint North America

Remarks

For addresses in countries other than the United Kingdom, skip the OtherCity parameter. The example that follows skips the OtherCity parameter.

If an address is not already separated into the above parameters (for example, "One Microsoft Way, Redmond, WA 98052"), you can parse the address to these parameters using the ParseStreetAddress method on the Map object. For optimal results with the FindAddressResults method, you should parse the address by hand.

To generate results more quickly for addresses in the United States, add the Region parameter.

Although only one parameter is required, using more parameters helps ensure that the results returned have greater accuracy.

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

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

Example

  [Microsoft Visual Basic 6.0]
  Sub FindAddressSearch()   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.FindAddressResults("One Microsoft Way", "Redmond", , "WA", , geoCountryUnitedStates)   MsgBox "The first item in the find list is: " _     + objFindResults.Item(1).Name
  End Sub
[C#]
void FindAddressSearch() { MapPoint.Application objApp = new MapPoint.Application(); MapPoint.FindResults objFindResults = null; object key = 1; MapPoint.Location objLoc = null; //Set up application objApp.Visible = true; objApp.UserControl = true; //Output first result of find search objFindResults = objApp.ActiveMap.FindAddressResults("One Microsoft Way", "Redmond", "", "WA", "", MapPoint.GeoCountry.geoCountryUnitedStates); 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 code example is specifically for use in MapPoint North America; it is for illustration purposes only.