-
Two questions about forms:
1. I have a form that can be called from some other forms. How do I know which form calls this form. Is there a property I can evaluate/examine (stacks?) or do I have to introduce a variable to hold the name of calling form?. There is the 'ownerform' paramater you can give using form.show method but I can't figure out how to use it in the called form to know who called...?
2. How do I check if a specific (child)form is open besides by looping through all open forms and checking the name/caption. I am looking for something like IsLoaded(frmMyForm) or IsOpen(frmMyForm), something VB-intrinsic that I might haven't come across yet..?
Thanks in advance
-
frmMyForm.Parent will give you the owner of the form.
frmMyForm.Visible will tell you if the form is loaded.(unless you hide it for some reason)
Hope this helps
-
I guess I forgot to mention these two important facts regarding question 1:
a. there is no 'parent' property of a form
b. a childform can't be set as an owner of a called form
As to question 2, just forms.visible is not enough, i need to know whether the form is loaded even if it's hidden.
-
You can loop throught the Forms collection.
Note that when you access a property of the form and it's not loaded, it will load first. So that doesn't help, that way each form is always loaded... Better use the forms collection, that only contains the loaded forms.
-
I was really looking for a way without having to loop through the form collection. I guess there is none? and I just have to use the loop :(
or.. anyone else has any idea?