Solved

Vb.net Code Snippet Errors

Posted on 2013-01-24
1
420 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Receiving a string from a WebService Push 21 51
VB.NET Repostiory Pattern 7 37
HTML - Color not displaying correctly in EMAIL. 6 41
vb.net and creating a class 5 17
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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