←  Desktop Programming

Pixel2Life Forum

»

C# - No overload for 'Form1_Load' ...

Red0z's Photo Red0z 07 Aug 2009

Hey guys, i'm trying to get this to work, but whenever i add 'FormClosingEvent f' to

  public void Form1_Load(object sender, EventArgs e, FormClosingEventArgs f)
  {
  f.Cancel = true;
  base.OnClosing(f);
  }



i get the error 'Error 1 No overload for 'Form1_Load' matches delegate 'System.EventHandler'



So what could the problem be ? 

Do i need to add something to 'this.Load += new System.EventHandler(this.Form1_Load);' ? or what? :)



Thank you in advance!! :)
Quote

Demonslay's Photo Demonslay 04 Oct 2009

I don't do much C#, but I can tell you the error means there isn't a function of that name with those arguments that is meant to be overloaded. To me, it means if you aren't trying to overload a function already defined with the language, then you may be declaring it incorrectly elsewhere. Make sure all types for your arguments match what they should be.
Quote