当前位置: 动力学知识库 > 问答 > 编程问答 >

vb.net - How can i grab text from a web browser?

问题描述:

I need to go into my implemented web browser and take text from lets say a label on the page. For example on this page it says "Related Questions" I need to copy that text and paste it into my from. Thanks in advance :)

网友答案:

Apparently you're using a WebBrowser element to show a homepage on your form. Use the following short code snippet to get the source code of the website you're viewing (the source code will be written into the TextBox1 in that example). Now you'll just have to filter out whatever you need (in your case it's a certain text which is hopefully between two HTML elements for ease). You might need RegEx for that (in case you're looking for an easy solution).

TextBox1.Text = WebBrowser1.DocumentText
分享给朋友:
您可能感兴趣的文章:
随机阅读: