this code works for vs.2003, how is this done with vs.2005 beta 2
Dim doc As mshtml.HTMLDocument = DirectCast(webBrowser1.Document, mshtml.HTMLDocument)< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
' Cast to the interface that defines the event you're interested in
Dim docevents As mshtml.HTMLDocumentEvents2_Event = DirectCast(doc, mshtml.HTMLDocumentEvents2_Event)
' Define a handler to the onclick event
AddHandler docevents.onclick, AddressOf onclickproc
'Dim docevents As mshtml.HTMLDocumentEvents2_Event = webBrowser1.Document.DomDocument.mshtmlDocumentClass.IhtmlDocument5.onfocusout
AddHandler docevents, AddressOf onclickproc
Need to capture some htmldocument events. The above code works for VS.2003 but not for VS.2005 beta 2. I’ve tried various changes- like changing document to domdocument. I can examine the webbroswer1 object in debug and can see the “webBrowser1.Document.DomDocument.mshtmlDocumentClass.IhtmlDocument5.onfocusout” but can not hook my event handler to it.
Any help would be appreciataed.

webbrowser html events vs.2005
bullpit
I need to find a way to trap "NavigateError" event while I have been using the Forms.WebBrowser class of 2005-Beta. Can anybody please help me in this matter I have been despirately looking forward to your help.
Thanks,
Sohail.
PatrickL
LS_
Antonio from Malibu
Use both LosingFocus and Focusing. Curiously, LosingFocus has the ToElement, and Focusing has from FromElement. Focusing fires after LosingFocus (at least in my little test).
jmparks
The event I needed was on field focus out. Modified the above to handle this and it works.
The latest I found was :
Dim doc As mshtml.HTMLWindow2Class = CType(webBrowser1.Document.Window.DomWindow, mshtml.HTMLWindow2Class)Dim DOM As mshtml.IHTMLDocument5 = CType(doc.document, mshtml.IHTMLDocument5)
AddHandler DOM.onfocusout, AddressOf focusOutSub
It broke on onfocusout not being a DOC5 event. Not sure why I could not find your solution, but everything pointed to DOC5 events.
vwgolfman
any idea why fromElement is nothing. docs indicate that this should contain the element that was navigated from. the toElement is populated but that doen't help to know where it came from and ultimately retrieve fromElement properties (like the value of a text input field).
tia
jas
stayfitsoftware
See the help file for the events available on HtmlDocument, but here is how you would add a handler for the HtmlDocument.Click event.
Dim htmlDoc As HtmlDocument
htmlDoc = WebBrowser1.Document
AddHandler htmlDoc.Click, AddressOf htmlDoc_ClickI'm not sure I've gotten the crux of your question, though...
peter lam