I have to replace our MapPoint with Bing Maps. I have reviewed the online instructions but I can't get past the first part of the code.
My code fails on this line:
myFindResults = mapService.FindService.FindAddress(findAddressSpec);
I can't find the correct Bing code to use.
private
void btnAddress_Click(object
sender, System.EventArgs e)
{
#region New code
Jason.MapPoint.
Address myAddress =
new
Address();
string strAddress =
string.Empty;
if (!string.IsNullOrEmpty(txtStreetName.Text))//FxCop
Change
strAddress = txtStreetName.Text;
myAddress.AddressLine = strAddress;
myAddress.PrimaryCity = txtAddressCity.Text;
myAddress.Subdivision = ddlAddressState.SelectedItem.Text;
myAddress.PostalCode = txtAddressZip.Text;
FindOptions myFindOptions =
new
FindOptions();
myFindOptions.ThresholdScore = 0;
// Set up the specification object
FindAddressSpecification findAddressSpec =
new
FindAddressSpecification();
findAddressSpec.InputAddress = myAddress;
findAddressSpec.Options = myFindOptions;
findAddressSpec.DataSourceName =
"MapPoint.NA";
FindResults myFindResults;
mapService =
new
MapPointService();
myFindResults = mapService.FindService.FindAddress(findAddressSpec);
#endregion
BindData(myFindResults);
if (dgdAddressDetails.Rows.Count > 0)
{
FormatGrid();
}
else
{
dgdAddressDetails.Columns.Clear();
FACESNET.CommonFramework.UserControls.
UserControlHandler.GetMessagebox(this.Page).SetMessagebox("Faces",
BwCoError.GetErrorUserMessage(185),
MessageBoxImageType.Error,
MessageBoxButtons.OK);
}
this.Show();
this.Visible =
true;
}
}