Внутри GetSponse JSON Geocode, код, предоставленный Microsoft, использует функцию для возврата результатов. Тем не менее, я хочу использовать результаты вне функции, но после этого я не могу получить доступ к данным из функции. Возможно, код может объяснить это более четко:Доступ к переменной внутри функции
Dim geocodeRequest As New Uri(String.Format("http://dev.virtualearth.net/REST/v1/Locations?q={0}&key={1}", query, key))
Dim latlong_adress As BingMapsRESTService.Common.JSON.Location = Nothing
GetResponse(geocodeRequest, Function(x)
MsgBox(x.ResourceSets(0).Resources.Length & " result(s) found.")
latlong_adress = x.ResourceSets(0).Resources(0)
'Correct results:
MsgBox(latlong_adress.Confidence)
MsgBox(latlong_adress.EntityType)
MsgBox(latlong_adress.Point.Coordinates(0) & ", " & latlong_adress.Point.Coordinates(1))
Return 0
End Function)
'Empty: --> is nothing
If latlong_adress IsNot Nothing Then
MsgBox(latlong_adress.Confidence)
MsgBox(latlong_adress.EntityType)
MsgBox(latlong_adress.Point.Coordinates(0) & ", " & latlong_adress.Point.Coordinates(1))
End If
Как я могу получить доступ к данным из ответа после того, как был получен ответ?