How to prevent WebBrowser control correspond to click event twice after loads html file twice?
C#
1
Posts
1
Posters
0
Views
1
Watching
-
In my windows application,i embed a Com webbrowser control.In DocumentComplete Event i add thid code:"Event= (HTMLDocumentEvents2_Event)axWebBrowser1.Document;Event.onclick += new mshtml.HTMLDocumentEvents2_onclickEventHandler(ClickEventHandler);" the ClickEventHandler function is defined as : private bool ClickEventHandler(mshtml.IHTMLEventObj e) { MessageBox.Show(e.type + ":" + e.srcElement.tagName); return true; } Now the problem is,when i first load a html file,it work correctly,but when i load a new file again,the MessageBox appear twice,load third file,it appear three time,and so on.So,What can i do to get rid of it,Let the message just appear one time. I will appreciate you help!