Calling a click event if there's one attached

  • Thread starter Thread starter Claire
  • Start date Start date
C

Claire

Is it possible to call a controls click event if it has one attached?

In a previous language I'd use something similar to
if (sender.OnClick != null)(button(sender).OnClick(sender,e));

thank you
 
Is it possible to call a controls click event if it has one attached?

In a previous language I'd use something similar to
if (sender.OnClick != null)(button(sender).OnClick(sender,e));

thank you

PerformClick method.
 
Only the Control itself can access the event itself; sometimes (but
not often) a "OnWhatever" method is public; /not/ in this case - but
if this is winforms, there is a DoClick() method [or similar] that
should do the job

Marc
 
Is it possible to call a controls click event if it has one attached?

In a previous language I'd use something similar to
if (sender.OnClick != null)(button(sender).OnClick(sender,e));

thank you

I think Claire wants to see if a Control has an event attached at run-
time and if it has it, run it.
I think this can be done with Reflection namespace but I may say a
stupid thing...
Hope this helps... if it isn't stupid... :)
 

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

Back
Top