Get Event Argument Value

  • Thread starter Thread starter shapper
  • Start date Start date
S

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
 
shapper said:
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
 
Back
Top