mikey
09-01-2003, 09:44 AM
Say you have a form, Form2 that can be called directly from a menu or alternatively from another form, Form1 (in this case it is called modally with Form1 as the owner of Form2).
In the Form_Load event of Form2 I want to determine where its been called from - in particular, if it has been called from Form1.
The following have been tried..
1) Querying Form1.Visible - It seems to attempt to load Form1 (obviously to poll this property) and although it does not show the form it does run part the Form_Load event of Form1 - which I don't want - I simply want to know if it's loaded or not.
2) Querying Me.Owner/Parent - No such properties.
3) "IsNull (Form1)" always returns False.
4) "Form1 Is Nothing" always returns False.
Any ideas? (other than declaring global variables to track them)
P/s - I suppose this is a wake-up call about the programming slackness inadvertently encouraged by the non-strictness of VB, as other truly object-oriented languages such as C++ would no doubt require you to create, manage and destroy individual instances of all objects loaded into memory at run time - including Forms thereby making problems such as this very intuitive to solve.
In the Form_Load event of Form2 I want to determine where its been called from - in particular, if it has been called from Form1.
The following have been tried..
1) Querying Form1.Visible - It seems to attempt to load Form1 (obviously to poll this property) and although it does not show the form it does run part the Form_Load event of Form1 - which I don't want - I simply want to know if it's loaded or not.
2) Querying Me.Owner/Parent - No such properties.
3) "IsNull (Form1)" always returns False.
4) "Form1 Is Nothing" always returns False.
Any ideas? (other than declaring global variables to track them)
P/s - I suppose this is a wake-up call about the programming slackness inadvertently encouraged by the non-strictness of VB, as other truly object-oriented languages such as C++ would no doubt require you to create, manage and destroy individual instances of all objects loaded into memory at run time - including Forms thereby making problems such as this very intuitive to solve.