Cannot capture event from webcontainer

Hello:

I have a WebContainer called “ProductPurchases” that I embed with a WebPage using the EmbedWithin method. So far, so good.

Here’s where I’m stuck:

I created an Event Definition within the WebContainer called: GenerateReport. (it takes no arguments) and I use RaiseEvent GenerateReport (within a button pressed event). The button is also a part of the WebContainer.

I created a Method in my webpage called: GenerateReportHandler (with no arguments).

Here’s my code for embedding the webcontainer and “attempting” to add the event handler:

var mPurchases As New ProductPurchases(purchaseList)

AddHandler mPurchases.GenerateReport, AddressOf GenerateReportHandler

mPurchases.SetBorderAttributes()
mPurchases.EmbedWithin(self, 0, 160, mPurchases.Width, mPurchases.Height)
mPurchases.Left = (self.Width - mPurchases.Width) / 2

When I attempt to compile, I get the following errors:

DeskRegSigninPage.EmbedPurchasesContainer, line 3
Type mismatch error. Expected delegate Delegate( ProductPurchases.ProductPurchases ), but got delegate Delegate( )
AddHandler mPurchases.GenerateReport, AddressOf GenerateReportHandler

AND this error:

DeskRegSigninPage.EmbedPurchasesContainer, line 3
This method requires fewer parameters than were passed
AddHandler mPurchases.GenerateReport, AddressOf GenerateReportHandler

I’m completely at a loss at this point. Any thoughts?

i believe the first argument is always the sender object in your case the ProductPurchases

drop this cc in a window and add a event by menu to see if the method is same as yours.

Thanks. I figured out where I went wrong. The sender As Object argument was definitely needed, however when I originally tried it, I had also placed that argument when defining the Event Definition. I later removed it from both because I couldn’t get it to work that way either.

Thanks for the tip.