Skip to main content

RequestResultBase.FaultReason Property

Returns the fault reason of a request.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v24.1.dll

NuGet Package: DevExpress.Wpf.Map

Declaration

public string FaultReason { get; }

Property Value

Type Description
String

A String value.

Example

This example demonstrates how to manually process received Bing Search request results.

Important

On May 21, 2024, Microsoft announced that Bing Maps for Enterprise and its API will be discontinued. Azure Maps will be a single unified enterprise mapping platform available from Microsoft.

We are working on API compatible with Azure Maps and expect to ship it with our next major release (v24.2).

If you have an existing license to Bing Maps for Enterprise, you can continue using our existing API. You need to transition to new API until June 30, 2025 (free and basic license) or until June 30, 2028 (enterprise license).

The last date you can get a new license to Bing Maps for Enterprise is June 30, 2025. If you do not have an existing license after that date, you would not be able to use our map controls with Bing Maps or Azure Maps (until we release the new API). During that time, you can use other map providers supported by our controls, such as OpenStreetMap.

Note

If you run the application, and see a window with the following error message: ”The specified Bing Maps key is invalid. To create a developer account, refer to https://www.microsoft.com/en-us/maps/create-a-bing-maps-key”, refer to the following tutorial: How to: Get a Bing Maps Key.

View Example

Private Sub searchProvider_SearchCompleted(ByVal sender As Object, ByVal e As BingSearchCompletedEventArgs)
    If e.Cancelled Then
        Return
    End If
    If e.RequestResult.ResultCode <> RequestResultCode.Success Then
        Return
    End If

    Dim sb As New StringBuilder()

    Dim requestResult As SearchRequestResult = e.RequestResult
    sb.Append(String.Format("Result Code: {0}" & vbLf, requestResult.ResultCode))
    If String.IsNullOrEmpty(requestResult.FaultReason) Then
        sb.Append(String.Format("Fault Reason: (none)" & vbLf, requestResult.FaultReason))
    Else
        sb.Append(String.Format("Fault Reason: {0}" & vbLf, requestResult.FaultReason))
    End If
    sb.Append(String.Format("Search Location: {0}" & vbLf, requestResult.Keyword))
    sb.Append(String.Format("Estimated Matches: {0}" & vbLf, requestResult.EstimatedMatches))
    sb.Append(String.Format("SearchResults:" & vbLf & "{0}", ProcessLocationList(requestResult.SearchResults)))

    tbSearchResult.Text = sb.ToString()

End Sub

Private Function ProcessLocationList(ByVal results As List(Of LocationInformation)) As String
    If results Is Nothing Then
        Return ""
    End If

    Dim sb As New StringBuilder()
    For i As Integer = 0 To results.Count - 1
        sb.Append(String.Format("{0}) {1}", i + 1, ProcessLocationInformation(results(i))))
    Next i
    Return sb.ToString()
End Function
Private Function ProcessLocationInformation(ByVal info As LocationInformation) As String
    If info Is Nothing Then
        Return ""
    End If

    Dim sb As New StringBuilder()

    sb.Append(String.Format("{0}" & vbLf, info.DisplayName))
    sb.Append(String.Format(vbTab & "Adress: {0}" & vbLf, info.Address))
    sb.Append(String.Format(vbTab & "Location: {0}" & vbLf, info.Location))
    Return sb.ToString()
End Function

The following code snippets (auto-collected from DevExpress Examples) contain references to the FaultReason property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also