Link to home
Start Free TrialLog in
Avatar of ccptechs
ccptechs

asked on

Passing parameters thru a Timer Eventhandler

I need to pass a custom parameter thru to the Timer.Tick event handler. I have used the EventHandler<TEventArg> but I get a type mismatch between the System.EventHandler and my derived TEventArg.

    public class telemetryEventArgs : EventArgs
    {
        MyVehicle _v;

        public telemetryEventArgs(MyVehicle vehicle)
        {
            v = vehicle;
        }
        public MyVehicle v
        {
            get { return _v; }
            set { _v = value; }
        }
    }


timeTelemetry.Tick += new EventHandler<TimeSpanEventArgs>(timeTelemetry_Tick);

Open in new window

Avatar of ericpeckham
ericpeckham
Flag of United States of America image

Can't you just do the following?

  timeTelemetry.Tick += timeTelemetry_Tick);
ASKER CERTIFIED SOLUTION
Avatar of ericpeckham
ericpeckham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ccptechs
ccptechs

ASKER

not answered