How exactly do you call your main form
You need to save a reference to the form somewhere. Basically, you can find your form in _screen.Forms collection. You can also add a reference to your form to some global object you're using in the application, but you would also need to release this reference when you're releasing the form.
How do you call your form
DO FORM FormName | [NAME VarName [LINKED]] [WITH cParameterList] [TO VarName] [NOREAD] [NOSHOW]
See
You can reference the form by: NAME VarName.
You can save the reference as a property in the calling object. You could instantiate an object to load your forms (as a Forms Manager) or you could use the _SCREEN object that holds a reference and a forms collection.
Using PUBLIC is not a good idea in an OOP architecture as it breaks encapsulation and leads to bugs.
I wrote a response, but now I don't see it ![]()
Do you have a main program in your application calling the main form with something like DO FORM myMainForm
If yes, look at the NAME clause of DO FORM command in help.
If not, your idea of using Main form's Load and global variable may work. I haven't tried this before.
Hao Q. wrote:
I thought I figured it out. I put the following into the Formset.Load
public main
main=THISFORMSET
and now i can use main to refer to the formset. thanks a lot!
FormSets are not a good idea. And declaring them PUBLIC is not a good idea either (see above)..
Do not use FormSets. Use a main form instead.
See:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=261598&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1159346&SiteID=1
Off-topic. I don't understand how does this forum work. I saw several responses in this thread, but now again I only see 3 responses and few of mine are gone as well.
How can I disable Alerts globally Right now I have to uncheck the Alert button every time and if I forget, it brings this new Alert page and after pressing Cancel the message is gone...
What is wrong with "thisform"
In exit routine you could clear events and loop existing forms using _vfp.objects collection.
You might as well keep references in a custom oApp object that's created on entry (might also use _screen for this but I prefer custom oApp as you can also create application wide methods there).