How to get HTML from the URL and display it in certain place?

旧街凉风 提交于 2019-12-12 05:39:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!