Revers Polish Notation Calculator: Grabbing input and displaying result
<p>I have able to create a function that will perform Reverse Polish notation. The structure of the method  is fine the two issues I am running into is how to grab the formula the user inputs in <code>textBox1</code> and display the answer(formula = answer) on <code>textBox2</code>.  I have assigned to <code>textBox1</code> the variable <code>rpnValue</code> but it gives an error message <code>A field initializer cannot reference the non-static field, method, or property 'modified_rpn.Form1.textBox1'</code>. So once again how can I grab the formula the user inputs in <code>textBox1</code> and display the answer(formula = answer) on the multiline `textBox2?</p>

<p><strong>Code</strong></p>

<pre><code>namespace rpn
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        string rpnValue = textBox1.Text; 

        private void RPNCalc(rpnValue)
        {
            Stack&lt;int&gt; stackCreated = new Stack&lt;int&gt;();
            try
            {
                var tokens = rpnValue.Replace("(", " ").Replace(")", " ")
                                     .Split().Where(s =&gt; !String.IsNullOrWhiteSpace(s));
                foreach (var t in tokens)
                {
                    try
                    {
                        stackCreated.Push(Convert.ToInt32(t));
                    }
                    catch
                    {
                        int store1 = stackCreated.Pop();
                        int store2 = stackCreated.Pop();
                        switch (t)
                        {
                            case "+": store2 += store1; break;
                            case "-": store2 -= store1; break;
                            case "*": store2 *= store1; break;
                            case "/": store2 /= store1; break;
                            case "%": store2 %= store1; break;
                            case "^": store2 = (int)Math.Pow(store1, store2); break; 
                            default: throw new Exception();
                        }
                        stackCreated.Push(store2);
                    }
                }

                if (stackCreated.Count != 1)
                    MessageBox.Show("Please check the input");
                else
                    textBox1.Text = stackCreated.Pop().ToString();

            }
            catch
            {
                MessageBox.Show("Please check the input");
            }

            textBox2.AppendText(rpnValue);
            textBox1.Clear();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            RPNCalc(textBox1, textBox2);
        }
    }
}
</code></pre>

<p><img src="http://i.stack.imgur.com/HxTJi.jpg" alt="enter image description here"></p>
