المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : IHTMLElement onclick event method call



C# Programming
08-22-2009, 05:34 PM
HTMLDoc = (HTMLDocument)WebBrowser.Document;
iHTMLCol = HTMLDoc.getElementsByTagName("input");
//type the username in the text box

mshtml.HTMLElementEvents2_Event htmlElementEvents2_Event = null;

foreach (IHTMLElement iHTMLEle in iHTMLCol)
{
try
{
strAttriName = iHTMLEle.getAttribute("id", 0).ToString();
if (strAttriName == "go")
{
if (iHTMLEle != null)
{
if (iHTMLEle is mshtml.HTMLButtonElement)
{
htmlElementEvents2_Event = (mshtml.HTMLElementEvents2_Event)iHTMLEle.onclick ;
htmlElementEvents2_Event.onclick += new HTMLElementEvents2_onclickEventHandler(htmlElementEvents2_Event_onclick);
}
}
}
}
catch { }
}
}

See the code above.

i have one button in my browser (intternetExplorer object), on that button click i wanted to call a method or event method.

Could any buddy help me out it is argent.

Thanks in advance!

yogesh