Get events of declared Control

bigtree

New member
Joined
Mar 23, 2009
Messages
4
Programming Experience
1-3
I declared a browser in my VB.NET project (Dim browse as new WebBrowser). How am I supposed to get to the events (browse_NewWindow) of the declared thing?
Oh yeah, my code for my browser is
VB.NET:
CType(TabControl1.SelectedTab.WebBrowser(1))
 
Use the AddHandler statement.
 
That you can do with Option Strict Off and relaxed delegates. Normally you will specify the parameters for the handler Sub, which you can see by hovering the NewWindow event in your AddHandler code, reading the error message and/or read the documentation. In this case the NewWindow event is specified by the CancelEventHandler delegate, which has the regular sender parameter as type Object and e parameter as type CancelEventArgs; giving this method signature:
VB.NET:
Private Sub browse_NewWindow(ByVal sender As Object, ByVal e As CancelEventArgs)
 
Back
Top