Putting a code behind a button in C#
<p>I am trying to add a code behind the add button my code is this:</p>

<pre><code>class CalculateValues
    {
        private int _num1;
        private int _num2;


        public int Num1
        {
            get
            {
                return _num1;
            }
            set
            {
                _num1 = value;
            }
        }
        public int Num2
        {
            get
            {
                return _num2;
            }
            set
            {
                _num2 = value;
            }
        }
        public virtual int calculate()
        {
            return _num1 + _num2;

        }
    }
</code></pre>

<p>Here is the other code that has the button on it:</p>

<pre><code>public partial class Form2 : Form
    {
        public Form2()
        {
            CalculateValues myAdd = new CalculateValues();
            MulitplyValues Add = new MulitplyValues();
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            int total = myadd.Add(int.Parse(textBox1.Text), int.Parse(textBox2.Text));    
            MessageBox.Show(total.ToString());

        }
</code></pre>

<p>But everytime it tell me   <code>'myAdd' does not exist in the current context</code><br>
I am not understanding why it is not working. I have even tried a few different ways.</p>
