Share via


Address.CountryRegion Property

Address.CountryRegion Property

The country or region name of an address.


Public Dim CountryRegion As System.String


[C#]

public System.String CountryRegion;

Remarks

  • The bold portion of the following address is a CountryRegion property:

    "1 Microsoft Way, Redmond, WA 98052, United States"

  • Maximum string size is 44 characters.

  • The CountryRegion property can be set to a commonly used name for a country or region, or to the CountryRegionInfo.FriendlyName or CountryRegionInfo.OfficialName property. For example, "US," "USA," "U.S.A.," "United States," and "United States of America" are all recognized.

  • See CountryRegion Entity IDs for a table of FriendlyName and OfficialName properties.

Example

[Visual Basic]

'Set up the find address specification object using the whole address string
Dim findAddressSpec As New FindAddressSpecification()
findAddressSpec.InputAddress = New Address()
findAddressSpec.InputAddress.FormattedAddress = "1 Microsoft Way, Redmond, Washington, 98052, USA"
findAddressSpec.DataSourceName = "MapPoint.NA"

'Declare the return variable and find the address (MapPoint Web Service will parse it)
Dim findAddressResults As FindResults
findAddressResults = findService.FindAddress(findAddressSpec)

'Output the found address using the formatted address that is returned 
If (findAddressResults.NumberFound = 1) Then
 Console.WriteLine(findAddressResults.Results(0).FoundLocation.Address.FormattedAddress)
Else
 Console.WriteLine("Zero or multiple results found")
End If




[C#]

//Set up the find address specification object using the whole address string
FindAddressSpecification findAddressSpec = new FindAddressSpecification();
findAddressSpec.InputAddress = new Address();
findAddressSpec.InputAddress.FormattedAddress = "1 Microsoft Way, Redmond, Washington, 98052, USA";
findAddressSpec.DataSourceName = "MapPoint.NA";

//Declare the return variable and find the address (MapPoint Web Service will parse it)
FindResults findAddressResults;
findAddressResults = findService.FindAddress(findAddressSpec);

//Output the found address using the FormattedAddress property that is returned 
if (findAddressResults.NumberFound == 1) 
{
 Console.WriteLine(findAddressResults.Results[0].FoundLocation.Address.FormattedAddress);
}
else
{
 Console.WriteLine("Zero or multiple results found");
}


See Also

  Address Class   |   CountryRegionInfo.FriendlyName Property   |   CountryRegionInfo.OfficialName Property   |   CountryRegion Entity IDs