title: Quick simple example for learning delegate event
body: <p>I'm a new beginner on this topic. I created a <strong>c# win form</strong>. In this form, I have <strong>two textboxes</strong> and <strong>one label</strong>. What I want to do is create a delegate event to track the textbox's change and add up two numbers from <code>textbox1</code> and <code>textbox2</code>. The label will show the result automatically. Hope someone can provide me a example for this, thank you so much! There is something I have right now,</p>
  
  <p>events.cs:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  
  namespace Project3
  {
      public delegate void Calculate(int obj1, int obj2);
      public class events
      {
          int result;
          public int Add(int x, int y)
          {
              result = x + y;
              return result;
          }
      }
  }
  </code></pre>
  
  <p>Form1.cs:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace Project3
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
              label1.Text ="";
          }
          private void Form1_Load(object sender, EventArgs e)
          {
  
          }
  
          private void textBox1_TextChanged(object sender, EventArgs e)
          {
  
          }
  
          private void textBox2_TextChanged(object sender, EventArgs e)
          {
  
          }
      }
  }
  </code></pre>