System::EventHandler: function call missing argument list

I downloded VCPlusSamples.exe .

I tried building two sample projects (or solutions, whatever) on VC++ Express but it always stumbled at System::EventHandler lines like the one here in a header file.

this->Load += new System::EventHandler(this, Form_Load);

The build error msgs are:

y:\visual express\samples\c++\vc.net samples\vc.net - advanced .net framework (gdi+) - animation with gdi+\frmAbout.h(215) : error C3867: 'VCNET::frmAbout::Form_Load': function call missing argument list; use '&VCNET::frmAbout::Form_Load' to create a pointer to member

y:\visual express\samples\c++\vc.net samples\vc.net - advanced .net framework (gdi+) - animation with gdi+\frmAbout.h(215) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)

"function call missing argument list"

"a delegate constructor expects 2 argument(s)" It has two arguments already: this and Form_Load!

What's happening

 



Answer this question

System::EventHandler: function call missing argument list

  • Shashi Shekhar

    Where did you get the VCPlusSamples.exe from

    I can only find a link related to VS2003.NET, those samples will most likely not work in VC++ 2005 EE, especially not the .NET samples due to the changes between 1.1->2.0 framework.



  • J Smith

    That is where I got those samples from.

    I finally rectified the error.

    I changed all occurances of
    System::EventHandler(this, somemethod);

    to
    System::EventHandler(this, &ClassName::somemethod);

    It requires the class name included in resolving the pointer to a method even though the method is defined within the same class as it is being called.


  • System::EventHandler: function call missing argument list