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

ccptechsAsked:
Who is Participating?
 
ericpeckhamConnect With a Mentor Commented:
Sorry, I had a rogue closing parenthesis in that last comment - should be:

timeTelemetry.Tick += timeTelemetry_Tick;

But, now that I understand better what you're trying to do, I can see I didn't get it right.  I'll be back...
0
 
ericpeckhamCommented:
Can't you just do the following?

  timeTelemetry.Tick += timeTelemetry_Tick);
0
 
ccptechsAuthor Commented:
not answered
0
All Courses

From novice to tech pro — start learning today.