关于webcontrol和编码的问题 [英] Question about webcontrol and coding

查看:103
本文介绍了关于webcontrol和编码的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想知道是否可以从C#中的webcontrol捕获生成的链接。例如,插入需要完成搜索的链接。按提交,它进入另一页。是否有可能捕获该其他页面的链接并将其用于其他目的?



谢谢

解决方案

< blockquote>如果您使用 WebBrowser 控件,则可以在 HtmlDocument 中找到链接。



以下是一些示例代码



  //  确保文档已加载 
private void WebBrowser_DocumentCompleted( object sender,WebBrowserDocumentCompletedEventArgs e)
{
HtmlElementCollection links = WebBrowser.Document.Links;
// 做东西......
}





您可以在此处找到有关 WebBrowser 类的更多信息

< a href =http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser(v=vs.110).aspx> http://msdn.microsoft.com/en- us / library / system.windows.forms.webbrowser(v = vs.110).aspx [ ^ ]


Hi, so I wanna know if it possible to capture a generated link from webcontrol in C#. For example inserting a link that needs to have a search done. Pressing submit and it goes into another page. Is it possible to capture the link of that other page and use it for another purpose?

Thanks

解决方案

If you are using a WebBrowser control then the links can be found in the HtmlDocument.

Here is some example code

//Make sure document is loaded
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    HtmlElementCollection links = WebBrowser.Document.Links;
    //Do stuff...
}



You can find more information here about the WebBrowser Class here
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser(v=vs.110).aspx[^]


这篇关于关于webcontrol和编码的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆