title: Add function to dynamic button in C#
body: <p>I dynamically created a Form and inside I created a button, but when I try to add my function to the button it gives this error:</p>
  
  <blockquote>
    <p>Method name expected.</p>
  </blockquote>
  
  <p>I am using the following code:</p>
  
  <pre><code>        {
          ...
          Form newForm = new Form();
          newform.Size = new Size(477, 222);
          Button btn = new Button();
          btn.Size = new Size(121, 23);
          btn.Location = new Point(231, 102);
          btn.Text = "Text";
          btn.Click += new EventHandler(Funct(label1.Text, label12.Text));
          newForm.Controls.Add(btn);
      }
  
      public void Funct(string stringA, string stringB)
      {
          StreamWriter write = new StreamWriter(path);
          write.WriteLine(stringA + "-" + stringB);
          write.Close();
      }
  </code></pre>
  
  <p>What can I do to resolve this issue?</p>