# Cannot capture event from webcontainer

**URL:** <https://forum.xojo.com/t/cannot-capture-event-from-webcontainer/88884>\
**Category:** Web\
**Created:** [September 15, 2026, 4:40pm UTC](https://forum.xojo.com/t/cannot-capture-event-from-webcontainer/88884 "2026-09-15T16:40:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keith\_Keller](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/b9bd4f/32.png) [@Keith\_Keller](https://forum.xojo.com/u/Keith_Keller)\
**Post date:** [September 15, 2026, 4:40pm UTC](https://forum.xojo.com/t/cannot-capture-event-from-webcontainer/88884/1 "2026-09-15T16:40:27Z")

</div>

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:

```xojo
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?

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [September 15, 2026, 5:10pm UTC](https://forum.xojo.com/t/cannot-capture-event-from-webcontainer/88884/2 "2026-09-15T17:10:56Z")

</div>

> [@Keith\_Keller](#):
>
> I created a Method in my webpage called: GenerateReportHandler (with no arguments).

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.

---

<div class="post-metadata">

**Author:** ![Keith\_Keller](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/b9bd4f/32.png) [@Keith\_Keller](https://forum.xojo.com/u/Keith_Keller)\
**Post date:** [September 15, 2026, 5:49pm UTC](https://forum.xojo.com/t/cannot-capture-event-from-webcontainer/88884/3 "2026-09-15T17:49:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [September 15, 2026, 8:20pm UTC](https://forum.xojo.com/t/cannot-capture-event-from-webcontainer/88884/4 "2026-09-15T20:20:18Z")

</div>

> [@Keith\_Keller](#):
>
> Event

it can be used in the control template itself OR in the instance where it is placed.  
unfortunately the event did not come at every event method.  
at least it was years ago so.
