"SvenC" <sv***@community.nospamwrote in message
news:16**********************************@microsof t.com...
Hi T,
"T" <sw***********@gmail.comschrieb im Newsbeitrag
news:11**********************@k79g2000hse.googlegr oups.com...
>On May 14, 8:50 pm, T <sw.tejasvi...@gmail.comwrote:
>>Hi,
How do I fire the KeyDown event in Managed VC++? I am getting a
compile error saying "event does not have a raise method". Please
help.
regards,
T
I managed to fix this though I don't know why the compile failed. I
was trying to fire the event in a class derived from Panel. The fix is
to redeclare the event as:
__event KeyEventHandler *KeyDown;
As far as I know managed classes inherit public by default in contrast to
native C++. So did you explicitly inherit private from Panel?
Alternatively you could try to explicitly inherit with "public Panel"
..NET doesn't allow private inheritance.
>
Otherwise this could indicate a compiler bug.
No, it's the same in C# and VC++ 2005. Only the class which declares an
event can fire it. The public access refers to the ability to subscribe
handlers, not to trigger the event. Usually calling the base class has an
OnKeyDown method which you can call, resulting in the event being fired with
your parameters.
Or, you can hide the parent event as you've done, but anyone who subscribes
with a base class pointer won't see your event.
>
--
SvenC