问题
I'm in progress with my first application in visual basic, and I'm using the visual basic studio - My question is, how can I get raw HTML data from specified URL, and then display it in my form on the certain position?
I havent tried anything yet, because I havent found much solutions about this on the internet.
回答1:
You need to use the HttpClient
class or the WebClient
class to get the raw HTML as a string. Then, you can simply display the string in any control on your form such as a TextBox
or Label
control.
For instance:
Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim client As WebClient = New WebClient()
Label1.Text = client.DownloadString("http://www.stackoverflow.com")
End Sub
来源:https://stackoverflow.com/questions/13499908/how-to-get-html-from-the-url-and-display-it-in-certain-place