eventargs?

  • Thread starter Thread starter rom
  • Start date Start date
R

rom

i want to call a sub in vb.net like:
Private Sub X(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs)

where the second argument can sometimes be
RepeaterCommandEventArgs or any other kind of this
eventargs thing......
is there a way that I can call the function by myself? i
can send as first parameter the object itself (repeater,
datagrid etc.) but what with the second??

Thanks!
 
All event argument types derive from the System.EventArgs class. If you
define the second parameter as System.EventArgs you can then cast the e
parameter to the appropriate type based on the type of the sender parameter.

HTH

Alan
 
It sounds like you're wanting to acll an Event Handler for something other
than handling an event. While this is possible (set the EventArgs argument
to null), it is generally a sign that your code needs to be revised. If you
want to execute the same code in the Event Handler, you'd probably be best
off putting the code into another function that the Event Handler can call
as well as other entities.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
Back
Top