如何创建Web浏览器控件并将单个DocumentComplete事件与其关联?基本上我希望能够重用相同的DocumentComplete事件,但由于某种原因,它永远不会停止触发该事件,所以当我处理webbrowser对象时,它停止触发事件。但是我希望能够创建另一个控件并为它重用该事件!
欢呼声
答案 0 :(得分:1)
Dim web1 As New WebBrowser()
AddHandler web1.DocumentComplete, AddressOf DocumentCompleteEventHandler
' Do stuff
RemoveHandler web1.DocumentComplete, AddressOf DocumentCompleteEventHandler
web1.Dispose()
Dim web2 As New WebBrowser()
AddHandler web2.DocumentComplete, AddressOf DocumentCompleteEventHandler
' Do stuff
RemoveHandler web2.DocumentComplete, AddressOf DocumentCompleteEventHandler
web2.Dispose()