Event Invoking

  • Thread starter Thread starter perspolis
  • Start date Start date
P

perspolis

Hi
I have some textbox and add event handler for some their events.
I want to invoke their event handlers without using name of event handlers.
I mean for example :
this.textBox1.TextChanged+=new EventHandler(textChanged1);

I want to invoke TextChanged event without using textChanged1 event
handler.

thanks in advance
 
You aren't going to be able to do this. The framework does not allow
you to invoke an event from outside of the class (it is a security
violation, if you think about it, being able to execute code from a class,
saying you are from that class).

The only way I can think of to do this would be to get the delegate list
through reflection, and then invoke that. However, I wouldn't recommend it.

Instead, I would just expose the delegate list somehow, and invoke it
manually.

Hope this helps.
 

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