title: no overload for matches delegate 'system.eventhandler' MouseDown MouseUp MouseMove
body: <p>I have to create labels in a form depending on a string[] called "descripcio". Each parameter of "descripcio" corresponds to a new label.
  Each label needs three events, MouseDown, MouseUp and MouseMove. The same events for all labels. The code is:</p>
  
  <pre><code>public FormEquip(string[] descripcio)
  {
      InitializeComponent();
      this.descripcio = descripcio;
      inicialitza_descripcions();
  }
  
  private void inicialitza_descripcions()
  {
      for (int i = 0; i &lt; this.descripcio.Length; ++i)
      {
          System.Windows.Forms.Label Label = new System.Windows.Forms.Label();
          crea_label(ref Label2, 100, 50 * (i + 1), "D" + i, this.descripcio[i], 2 * i + 2);
          this.Controls.Add(Label);
      }
  }
  
  private void crea_label(ref System.Windows.Forms.Label Label, int x, int y, string nom, string text, int index)
  {
      Label.AutoSize = true;
      Label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      Label.Location = new System.Drawing.Point(x, y);
      Label.Name = nom;
      Label.TabIndex = index;
      Label.Text = text;
      Label.Visible = true;
      Label.MouseDown += new System.EventHandler(Label_MouseDown);
      Label.MouseUp += new System.EventHandler(Label_MouseUp);
      Label.MouseMove += new System.EventHandler(Label_MouseMove);
  }
  
  private void Label_MouseDown(object sender, MouseEventArgs e)
  {  
      this.isDragging = true;
  }  
  
  private void Label_MouseUp(object sender, MouseEventArgs e)
  {
      this.isDragging = false;  
  }  
  
  private void Label_MouseMove(object sender, MouseEventArgs e)
  {
      Control ctrl = sender as Control;  
      if (this.isDragging)  
      {  
          Point p1 = ctrl.PointToScreen(e.Location);  
          Point p2 = ctrl.Parent.PointToClient(p1);  
          ctrl.Location = p2;  
      }  
  }
  </code></pre>
  
  <p>This code generate an "no overload for "Label_MouseDown/Label_MouseUp/Label_MouseMove" matches delegate 'system.eventhandler'" error in this three lines:</p>
  
  <pre><code>    Label.MouseDown += new System.EventHandler(Label_MouseDown);
      Label.MouseUp += new System.EventHandler(Label_MouseUp);
      Label.MouseMove += new System.EventHandler(Label_MouseMove);
  </code></pre>
  
  <p>The first line "no overload for "Label_MouseDown" matches delegate 'system.eventhandler'".
  The second line "no overload for "Label_MouseUp" matches delegate 'system.eventhandler'".
  The third line "no overload for "Label_MouseMove" matches delegate 'system.eventhandler'".</p>
  
  <p>Before to write this post, I have seen several posts with the similar error message. I tried to follow the explanations that I could read in that posts, but I cannot get the solution. Thanks for all.</p>
  
  <p>Edit:</p>
  
  <p>Finally, I only have to change this part of code:</p>
  
  <pre><code>Label.MouseDown += new System.EventHandler(Label_MouseDown);
  Label.MouseUp += new System.EventHandler(Label_MouseUp);
  Label.MouseMove += new System.EventHandler(Label_MouseMove);
  </code></pre>
  
  <p>for:</p>
  
  <pre><code>Label.MouseDown += new System.Windows.Forms.MouseEventHandler(Label_MouseDown);
  Label.MouseUp += new System.Windows.Forms.MouseEventHandler(Label_MouseUp);
  Label.MouseMove += new System.Windows.Forms.MouseEventHandler(Label_MouseMove);
  </code></pre>
  
  <p>That's all. Thanks HuorSwords. </p>