c#中获取其它页面的文本框值
时间:2010-11-09 来源:zwpsky
首先在代码中添加Microsoft.mshtml.dll引用,该引用地址是在C:\Program Files\Microsoft.NET\Primary Interop Assemblies,
再在页面中添加一个webBrowse控件,用于获取网站页面。
using mshtml;
this.webBrowser1.Url = new Uri(http://www.);
public static string GetCodeName(WebBrowser wbMail)
{
HtmlDocument doc1 = wbMail.Document;
// checkCode 为需要获取网站页面中文本框的ID
HtmlElement element = doc1.GetElementById("checkCode");
string value = element.GetAttribute("value");
return value;
}
相关阅读 更多 +