title: Visual Studio C++/CLI Syntax Error when using .Net Windows Form
body: <p>I have the following code and Visual Studio C++ reports two errors:</p>
  
  <pre><code>#include "windows.h"
  
  #using &lt;mscorlib.dll&gt;
  
  #using &lt;System.dll&gt;
  
  #using &lt;System.Windows.Forms.dll&gt;
  
  using namespace System::Windows::Forms;
  
  __gc class MyForm : public Form
  
  {
  
  public: 
  
  MyForm()
  
   { 
  
       Text = "Hello, Windows Forms!";
  
       Button* button = new Button();
  
       button-&gt;Text = "Click Me!";
  
       button-&gt;Click += new EventHandler(this, button_click);
  
       this-&gt;Controls-&gt;Add(button);
  
  }
  
  void button_click(Object* sender, EventArgs* e)
  
  {
  
  MessageBox::Show("Ouch!");
  
  }
  
  };
  
  int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  
  {
  
  Application::Run(new MyForm);
  
  }
  </code></pre>
  
  <p>and the errors:
  error C2061 Syntax Error: Event Args
  error C2061 Syntax Error: EventHandler</p>
  
  <p>What should I do to get the code running ?
  Thanx in advance.</p>