i'm pretty new c#, , ran today bug.
i'm making windows form application in visual c# in visual studio 2013. in "form1 [design]" tab of project, added menustrip, in created "new" , "quit" item.
when press "quit" button (identified here quitterlapplicationtoolstripmenuitem, automatically generated vs2013) have code run :
private void quitterlapplicationtoolstripmenuitem_click(object sender, canceleventargs c, eventargs e) { dialogresult resultat = messagebox.show("close?" + environment.newline + environment.newline + "really ? no more notifications ?", "closing", messageboxbuttons.yesno, messageboxicon.warning); if (resultat == dialogresult.yes) { messagebox.show("prog stopped correctly", "quit"); application.exit(); } else { c.cancel = true; this.windowstate = formwindowstate.minimized; this.showintaskbar = false; } }
and when try run this, error appears, saying :
no overload 'quitterlapplicationtoolstripmenuitem_click' matches delegate 'system.eventhandler'
oh, , here's line causing error :
this.quitterlapplicationtoolstripmenuitem.click += new system.eventhandler(this.quitterlapplicationtoolstripmenuitem_click);
what can ? i'm stuck , have not found me (and understand)
replace:
(object sender, canceleventargs c, eventargs e)
with
(object sender, eventargs e)
the parameters on method not correct: you've got sort of mish-mash of 2 different method signatures.
it's either supposed be:
private void quitterlapplicationtoolstripmenuitem_click(object sender, canceleventargs c)
or
private void quitterlapplicationtoolstripmenuitem_click(object sender, eventargs e)