Solved

Passing parameters thru a Timer Eventhandler

Posted on 2011-03-25
3
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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