How to pass data from Visual C# Form to Class method? : I need help with a Visual C# project. I can't figure out how to pass data from a form's textboxes to a class method for calculation and then get the result back to the form to display in a textbox or listbox or whatever. I keep geting "Cannot inplicitly convert type 'int' to 'System.Windows.Forms.Textbox'" exception in my class. 

For my setup I have a form with three textboxes (TxtFirstNumber, TxtSecondNumber, TxtResult) and a button (BtnCalculate). When I click the button I want the two numbers to get passed to the class to add and the result to appear on the form textbox TxtResult. I have a form called "form1" and a class called "class1".

Here is the code I have so far with the class "using System.Windows.Forms;":

(CLASS)
    
    namespace ClassTesting
    {
        class class1
        {
            public static void AddTwoNumbers(int FirstNumber, int SecondNumber, ref TextBox TxtResult)
            {
            TxtResult = FirstNumber + SecondNumber;
            }
        }
    }

(FORM)

    namespace ClassTesting
    {
        public partial class form1 : Form
        {
            public form1()
            {
                InitializeComponent();
            }

            private void BtnCalculate_Click(object sender, EventArgs e)
            {
            Class1.AddTwoNumbers(Convert.ToInt32(TxtFirstNumber.Text), Convert.ToInt32(TxtSecondNumber.Text), ref TxtResult);
            }
        }
    }