eventargs?

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!
 
G

Guest

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
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top