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

مشاهدة النسخة كاملة : How to unregister the Event for a clicked tag ?



C# Programming
08-20-2009, 03:26 PM
Hi all,

i am using SHDocVw.InternetExplorer with shellwindow (BHO)

in the DocumentComplete event i have registered HTMLDocumentEvents2_Event (click)

my problem:

the click event is called recursively.
i need a solution, once the event is fired, then i want to unregister the event only for the particular button,image,link etc that i have clicked.

The code i have used inside the oncomplete event as bellow:

HTMLDocumentEvents2_Event DocEvents = (HTMLDocumentEvents2_Event)browser.Document;
DocEvents.onclick += new HTMLDocumentEvents2_onclickEventHandler(DocEvents_onclick);