Hi,
I want to pass a parameter from one windows form to another.
This is the error I get: Cannot pass 'WindowsApplication1.Form2.c' as ref or out, because 'WindowsApplication1.Form2.c' is a marshal-by-reference class
Any help would be much appreciated,
-Tim
I want to pass a parameter from one windows form to another.
C#:
//this function is in Form2, where c is a global public variable
private void button1_Click(object sender, System.EventArgs e)
{
c = (int) numericUpDown1.Value +
(int) numericUpDown2.Value;
Form1.PrintToTextBox(this);
}
//this is the function in Form1
public static void PrintToTextBox(Form2 obj)
{
string b;
b = obj.c.ToString();
}
This is the error I get: Cannot pass 'WindowsApplication1.Form2.c' as ref or out, because 'WindowsApplication1.Form2.c' is a marshal-by-reference class
Any help would be much appreciated,
-Tim
Last edited by a moderator: