I have the following EventHandler
to which I added a parameter MusicNote
music:
public void PlayMusicEvent(object sender, EventArgs e,MusicNote music)
{
music.player.Stop();
System.Timers.Timer myTimer = (System.Timers.Timer)sender;
myTimer.Stop();
}
I need to add the handler to a Timer
like so:
myTimer.Elapsed += new ElapsedEventHandler(PlayMusicEvent(this, e, musicNote));
but get the error:
"Method name expected"
EDIT: In this case I just pass e from the method which contains this code snippet, how would I pass the timer's own EventArgs
?