Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim client As New WebClient()
Dim result As String
Dim xdoc As New XmlDocument
Dim mgr As New XmlNamespaceManager(xdoc.NameTable)
Try
result = Encoding.UTF8.GetString(client.DownloadData("http://maps.google.com/maps/geo?q=austin,+tx+78730&output=xml&key=abcdefg"))
xdoc.LoadXml(result)
mgr.AddNamespace("anyPrefix", "http://earth.google.com/kml/2.0")
Me.TextBox1.Text = xdoc.SelectSingleNode("/anyPrefix:kml/anyPrefix:Response/anyPrefix:Status/anyPrefix:code", mgr).InnerText
Me.TextBox2.Text = xdoc.SelectSingleNode("/anyPrefix:kml/anyPrefix:Response/anyPrefix:Status/anyPrefix:request", mgr).InnerText
Catch
MsgBox("Unable to download data!")
End Try
End Sub
|