Hi all.

I am developing an application for WM 5.0 in VS 2005. The application reads
data from XML files and creates dynamic buttons based on that information.
Because of this, I need to add even handlers to each of the buttons.
However, once I've assigned the event, I need to read information from the
button that was pressed.

Because of this I'm running into two alternate problems. First, if I leave
the signature of the delegated sub as the standard (ByVal sender As Object,
ByVal e As System.EventArgs) I get an error in the function when I try to
call the name of the button saying "The targeted version of the .NET Compact
Framework does not support latebinding."

So, to fix this, I changed the signature to read (ByVal sender As Button,
ByVal e As System.EventArgs)

However, once I've done that I get an error telling me that the signatures
don't match.

To add the handler, I'm using the following code:


Dim btn as new Button
'Make changes to button, name it, etc.
AddHandler btn.Click, AddressOf RunProcess

After that I declare RunProcess as a sub with the standard or modified
signature.

Private Sub RunProcess(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim sName As String
Dim iNumber As Integer


sName = sender.Name

It's on the last line that the latebinding error occurs. If I change
"sender As Object" to "sender as Button" that latebinding error goes away,
but the delegate error appears. It feels like a catch 22 to me, but I
believe there's got to be a way around this.

Thanks for any help!
Joshua Wise