I have a simple question. I have a main form, and then a startup form from where I can select a new 3D model to generate. When selecting a new 3D model from the startup form, I want to check first whether the previous model I worked on has been saved or not. I simply want to pass a boolean value from the main form to the startup form using a delegate, but I can't seem to access the main form or any of its variables. I thought it would be as simple as saying: <code>frmMain myForm = new frmMain();</code>, but typing frmMain doesn't show up anything in intellisense.
Any hints?
Here's my suggestion: place a 3DModel object property in your main form:
Declare your startup form as a Dialog ( like OpenFileDialog) and do something like this:
your startup form should have a interface like this:
Your main form is not accessible to Startup form.You have to store it to something that is accessible at a point where you want to use it.
You can do it by following way also ( along with other ways :)
make sure you put this class in namespace which is accessible to both the forms.
Now In your frmMain form set the value of CCurrent.Saved and access it in your startup form.
Add a public property on your main form
you can then access
this.ParentForm.IsDirty
in your startup form,remember to pass a reference to the main form when you show the startup form ...
startupForm.showDialog(this);