Solved

Passing parameters thru a Timer Eventhandler

Posted on 2011-03-25
3
448 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:ccptechs
  • 2
3 Comments
 
LVL 2

Expert Comment

by:ericpeckham
ID: 35219286
Can't you just do the following?

  timeTelemetry.Tick += timeTelemetry_Tick);
0
 
LVL 2

Accepted Solution

by:
ericpeckham earned 500 total points
ID: 35219302
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
 

Author Closing Comment

by:ccptechs
ID: 35702421
not answered
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now