自訂搜尋

2009/08/07

C# 使用webBrowser控制項 操弄裡面的表單 *0*

private void webBrowser5_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
 if (webBrowser5.ReadyState < WebBrowserReadyState.Complete) return;

 HtmlElement btnSubmit = webBrowser5.Document.All["btsubmit"];
 HtmlElement Date_Year = webBrowser5.Document.All["Date_Year"];
 HtmlElement Date_Month = webBrowser5.Document.All["Date_Month"];
 HtmlElement Date_Day = webBrowser5.Document.All["Date_Day"];
 HtmlElement mycontent = webBrowser5.Document.All["mycontent"];

 Date_Year.SetAttribute("value", DateTime.Now.Year.ToString());
 Date_Month.SetAttribute("value", DateTime.Now.Month.ToString().PadLeft(2, '0'));
 Date_Day.SetAttribute("value", DateTime.Now.Day.ToString().PadLeft(2, '0'));
 mycontent.SetAttribute("value", tmp);
 btnSubmit.InvokeMember("click");
}

沒有留言:

張貼留言

讀取中…