I have three forms: Form1, Form2 and Form3. I want to be able to pass a reference to either Form2 or Form3 so that Form1 will invoke the appropriate one when a button is clicked. So I set up a Form property in Form1:
Code:
private System.Windows.Forms.Form m_frmAddEdit;
...
public System.Windows.Forms.Form AddEditForm
{
	  get { return m_frmAddEdit;  }
	  set { m_frmAddEdit = value; }
}
I've passed other object references in this manner (specifically, an OdbcConnection), so I figured this would be fine.

Unfortunately, when I try to pass a Form reference:
Code:
Form1 frm = new Form1();
frm.AddEditForm = Form2;
The compiler complains that:
'Form2' denotes a 'class' where a 'variable' was expected
and
'Form1.m_frmAddEdit' denotes a 'field' where a 'class' was expected
This latter error is in reference to the following line in Form1:
Code:
m_frmAddEdit frmToCall = new m_frmAddEdit();
What am I doing wrong here? I don't understand why C# expects the property I declared as a Form to be a 'variable'.

Do I need to be looking at some way to do this with Delegates instead? (I'd like to keep the calling/invoking logic inside Form1.)