vb.net - Adding MouseOver event to htmlDocument causes a System.NullReferenceException -


i have form webbrowser object named "mybrowser". when open webpage in browser, id of element mouse hovering on , show in textbox named "txtproperties".

i have tried achieve using following code:

public class buildbrowser dim myhtmldocument htmldocument  private sub btnbrowsesubmit_click(sender object, e eventargs) handles btnbrowsesubmit.click     mybrowser.navigate(txtaddress.text) end sub    private sub document_mouseover(sender object, e htmlelementeventargs)     txtproperties.text = trycast(sender, htmldocument).getelementfrompoint(e.clientmouseposition).getattribute("id") end sub  private sub buildbrowser_load(sender object, e eventargs) handles mybase.load     myhtmldocument = mybrowser.document     addhandler myhtmldocument.mouseover, addressof document_mouseover end sub end class 

running causes exception, when code gets addhandler myhtmldocument.mouseover, addressof document_mouseover saying "null reference exception unhandled" - "an unhandled exception of type 'system.nullreferenceexception' occurred in myprogram.exe"

i've not come across type of error when adding handler object before before - gratefully received.

thanks,

paul.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -