Reference To A Non-Shared Member Requires an Object Reference

  • Thread starter Thread starter Austin Althouse
  • Start date Start date
A

Austin Althouse

Guest
Hello, I am getting an error (stated in title) and I can't figure out why it is giving me this error. Here is the code:

Using WB As New WebClient
Try
WB.Headers.Add("User-Agent", )
Dim ForecastData As String = WB.DownloadString($"https://api.weather.gov/stations/{TextBox3.Text}/observations/latest")

Dim weather As WeatherData = JsonConvert.DeserializeObject(Of WeatherData)(ForecastData)

Label5.Text = Period.detailedForecast

Catch ex As Exception
End Try
End Using


Error occurs on the Label5.Text = Period.detailedForecast line. The classes that go with this are:

Public Class Context
Public Property wx As String
Public Property geo As String
Public Property unit As String
Public Property vocab As String
End Class

Public Class Geometry
End Class

Public Class Period
Public Property number As Integer
Public Property name As String
Public Property detailedForecast As String
End Class

Public Class WeatherData
Public Property context As Context
Public Property geometry As Geometry
Public Property updated As DateTime
Public Property periods As Period()
End Class

What is going on and how can I correct it?

Continue reading...
 
Back
Top