Get Event Argument Value

Get Event Argument Value

am 24.01.2008 15:08:59 von Shapper

Hello,

I have a custom control which has an event named Update:

Private Sub MyControl_Update(ByVal sender As Object, ByVal e As
EventArgs)
Dim MyControl As Form = CType(sender, Form)
End Sub

I am trying to get a property called "Name" from "e" EventArgs.

The "e" is custom and inherits from EventArgs. I debugged it and "e"
shows as follows:

e {FormButtonClickEventArgs} System.EventArgs

FormButtonClickEventArgs {FormButtonClickEventArgs}
FormButtonClickEventArgs
_Name "Save" String
+ Empty {System.EventArgs} System.EventArgs
Name "Save" String

So I need to get the value "Save".

How can I do this?

Thanks,

Miguel

Re: Get Event Argument Value

am 24.01.2008 17:48:18 von Anthony Jones

"shapper" wrote in message
news:7837b9fd-8183-4121-8541-7c7950d8c75f@e6g2000prf.googleg roups.com...
> Hello,
>
> I have a custom control which has an event named Update:
>
> Private Sub MyControl_Update(ByVal sender As Object, ByVal e As
> EventArgs)
> Dim MyControl As Form = CType(sender, Form)
> End Sub
>
> I am trying to get a property called "Name" from "e" EventArgs.
>
> The "e" is custom and inherits from EventArgs. I debugged it and "e"
> shows as follows:
>
> e {FormButtonClickEventArgs} System.EventArgs
>
> FormButtonClickEventArgs {FormButtonClickEventArgs}
> FormButtonClickEventArgs
> _Name "Save" String
> + Empty {System.EventArgs} System.EventArgs
> Name "Save" String
>
> So I need to get the value "Save".
>
> How can I do this?
>

Why not change the signature to use:-

ByVal e As FormButtonClickEventArgs

since that is the specific type of e. You can then access e.Name



--
Anthony Jones - MVP ASP/ASP.NET