How do I pass arguments to my function with ElapsedEventHandler?
NewTimer->Elapsed+=gcnew ElapsedEventHandler(&TimerEvent(String1,String2));
???
I get this error:
'System::Timers::ElapsedEventHandler' : a delegate constructor expects 2 argument(s)
Any help appreciated.
ElapsedEventHandler
defines a delegate that takes two parameters:
ElapsedEventArgs
, which contains the time that the timer was triggered.If you need other information in your event handler, store them in fields on your class, and reference them that way.