Reputation: 752
I am working windows mobile application in compact framework 3.5.I want to close a windows form from another windows form.
I tried like below,
Book newform = (Book)Application.OpenForms["Book"];
newform.Close();
I am getting this error "'System.Windows.Forms.Application' does not contain a definition for 'OpenForms'
".I checked in Application form and this OpenForms
is not available.May i know the equivalent fix of OpenForms
in compact framework or please provide me an alternative solution.
Thanks
Upvotes: 0
Views: 201
Reputation: 54417
There is no equivalent. The Compact Framework is compact because it doesn't include a lot of stuff that isn't needed. If you need to access a form later then keep a reference to it when you create it, which is what you should generally be doing in an application targeted at the full Framework anyway.
You don't necessarily have to create a class that tracks all forms, as is done in the link provided by Blogbeard. If this is just a one-off then just keep that one reference. If you need to do it lots for various forms, then a centralised form manager may be a better option.
Upvotes: 1