-
May 30th, 2010, 11:55 PM
#1
Accessing Objects Between Forms
Hi all,
I'm fairly new to C# and have run into a problem. I have one form mainForm which creates a new form optionsForm when a button is clicked.
private void button_Click(object sender, EventArgs e)
{
Options optionsForm = new Options(this);
DialogResult result = optionsForm.ShowDialog(this);
}
In the optionsForm, I've tried to pass mainForm by reference so I could access its objects.
private form_VisionSystem mainForm = null;
public Options(Form callingForm)
{
mainForm = callingForm as form_VisionSystem;
InitializeComponent();
}
I would like to access an object from mainForm and that object's methods from optionsForm. Is this possible, and if so how could I go about achieving this.
Any help would be greatly appreciated.
Regards,
Antonio.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|