Delegate types are not required when attaching events, the compiler can figure it out for you. Try this instead:
timer.Tick += timer_Tick;
As for why you get the error currently, the EventHandler
delegate is declared like this:
public delegate void EventHandler<TEventArgs>(
Object sender,
TEventArgs e
)
This means the type you put in the brackets represents the second argument in the function.
So when you type EventHandler<object>
, the compiler looks for a function like timer_Tick(Object sender, object e)
which it does not find, hence the error. To use the full delegate type, it would have to be EventHandler<EventArgs>