Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I put this code on my server a while back. Recently I needed a modification and I'm getting an error in VS now. Still works on the server, only getting an error in debugging. I'm getting the error on
item.Values
Im getting the error: Overload resolution failed because no accessible 'Values' can be called with these arguments: 'Public Overrides Function Values(Of T)() as IEnumberable(of T)

What I have tried:

<pre lang="vb"><pre> Protected Sub getThermoss()
        Dim request As WebRequest = WebRequest.Create("http://192.168.1.42/JSON?request=getstatus&ref=25")
        ' If required by the server, set the credentials.
        request.Credentials = CredentialCache.DefaultCredentials
        ' Get the response.
        Dim response As WebResponse = request.GetResponse()
        ' Display the status.
        'Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
        ' Get the stream containing content returned by the server.
        Dim dataStream As Stream = response.GetResponseStream()
        ' Open the stream using a StreamReader for easy access.
        Dim reader As New StreamReader(dataStream)
        ' Read the content.
        Dim responseFromServer As String = reader.ReadToEnd()
        ' Display the content.

        Dim json As String = responseFromServer
        Dim ser As JObject = JObject.Parse(json)
        Dim data As List(Of JToken) = ser.Children().ToList
        Dim output As String = ""

        For Each item As JProperty In data
            item.CreateReader()
            Select Case item.Name
                Case "Devices"
                    output += "Comments:" + vbCrLf
                    For Each comment As JObject In item.Values
                        Dim u As String = comment("value")
                        Dim d As String = comment("date")
                        Dim c As String = comment("comment")
                        output = u
                    Next



            End Select
        Next

        Thermos.Text = output
        ' Clean up the streams and the response.
        reader.Close()
        response.Close()
    End Sub
Posted
Comments
Christian Graus 14-May-18 19:31pm    
It's JSON, not jason. If it works on the server, there's an issue in your debug environment
Bryian Tan 14-May-18 21:09pm    
Maybe the development environment is missing the Newtonsoft.Json library.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900