Solved

Vb.net Code Snippet Errors

Posted on 2013-01-24
1
416 Views
Last Modified: 2013-01-25
Can Someone help me fix errors in this code?


I get errors on


 Error      1      Type 'GeocodeService.Credentials' is not defined.      

Error      2      Value of type '1-dimensional array of BTDT.GeocodeService.ConfidenceFilter' cannot be converted to 'System.Collections.ObjectModel.ObservableCollection(Of BTDT.GeocodeService.FilterBase)'.      

Error      3      'Geocode' is not a member of 'BTDT.GeocodeService.GeocodeServiceClient'.      

Error      4      The targeted platform does not support latebinding.



    Private Sub MakeGeocodeRequest()

        Dim Results As String
        Try
            ' Set a Bing Maps key before making a request
            Dim key = "Bing Maps Key"

            Dim geocodeRequest As New GeocodeService.GeocodeRequest()

            ' Set the credentials using a valid Bing Maps Key
            geocodeRequest.Credentials = _
            New GeocodeService.Credentials() With {.ApplicationId = "mykey"}

            ' Set the full address query
            geocodeRequest.Query = "1 Microsoft Way, Redmond, WA"

            ' Set the options to only return high confidence results
            Dim filters() As GeocodeService.ConfidenceFilter = _
            {New GeocodeService.ConfidenceFilter() _
            With {.MinimumConfidence = GeocodeService.Confidence.High}}

            Dim geocodeOptions As New GeocodeService.GeocodeOptions() _
            With {.Filters = filters}

            geocodeRequest.Options = geocodeOptions

            ' Make the geocode request
            Dim geocodeServiceInstance As New GeocodeService.GeocodeServiceClient("BasicHttpBinding_IGeocodeService")
            Dim geocodeResponse = geocodeServiceInstance.Geocode(geocodeRequest)

            ' Use the results in your application.
            Results = geocodeResponse.Results(0).DisplayName

        Catch ex As Exception
            Results = "An exception occurred: " & ex.Message

        End Try

    End Sub

Open in new window

0
Comment
Question by:Dodsworth
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 38815740
Make sure you have proper assembly references added to your project and Namespace imports added to your page.
Also check this.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now