If actions is a Panel, am I able to raise the Click event of it’s parent?
I have this code at the moment, but the Click event isn’t a method, so this code is invalid.
Does anyone know how I can achieve this?
actions.Click += delegate(object Sender, EventArgs e)
{
((Panel)Sender).Parent.Click();
}
It’s not possible to raise a C#
eventdirectly from anotherclass(even if it’spublic). You could provide a method (with a sufficient access modifier) that raises theeventon your behalf and call that method in the otherclass.By the way, this is possible with reflection, but I consider that a dirty hack.