title: Defining a MouseEventHandler in C#
body: <p>I'm trying to define MouseEventHandlers such that the application will exit whenever the mouse is clicked or moved or whenever a key is pressed.  This is my first time using C#, but based on what I found online, I've written the code as follows:</p>
  
  <pre><code>     MouseDown += new MouseEventHandler(mouseClickedResponse);
       MouseMove += new MouseEventHandler(mouseMovedResponse);
       KeyDown += new KeyEventHandler(keyResponse);
  </code></pre>
  
  <p>which connects to:</p>
  
  <pre><code>private void keyResponse(object sender, EventArgs e)
      {
          Application.Exit();
      }
  
      private void mouseClickedResponse(object sender, EventArgs e)
      {
          Application.Exit();
      }
  
      private void mouseMovedResponse(object sender, EventArgs e)
      {
          if (firstCall)     //Keeps the application from exiting immediately
              firstCall = false;
          else Application.Exit();
      }
  </code></pre>
  
  <p>The problem that I'm finding is that while the KeyEventHandler works perfectly, I can move and click the mouse as much as I want to no avail.</p>
  
  <p>This is the sum total of the code that I've written to allow for user control; am I missing something?</p>