Colleagues,
I need to know, before opening (by selecting item in the bar menu) how many other forms are open in this parent MDI form.
I tried to do it in the child (SDI) form, in the Form_Load() event.
Since the argument "sender" in the Form_Load(sender As Object, e As EventArgs) event points on its own form (as hovering mouse pointer over "sender" in debug/break run has shown), not the calling one, I tried something like
and got an "Unhandled Exception" popup pointing on the Me.MdiParent.MdiChildren part.
What am I doing wrong?
TIA!
Regards,
Ilya
I need to know, before opening (by selecting item in the bar menu) how many other forms are open in this parent MDI form.
I tried to do it in the child (SDI) form, in the Form_Load() event.
Since the argument "sender" in the Form_Load(sender As Object, e As EventArgs) event points on its own form (as hovering mouse pointer over "sender" in debug/break run has shown), not the calling one, I tried something like
Code:
For Each loForm As Form In Me.MdiParent.MdiChildren
If loForm.Name <> Me.Name Then loForm.Close()
Next
and got an "Unhandled Exception" popup pointing on the Me.MdiParent.MdiChildren part.
What am I doing wrong?
TIA!
Regards,
Ilya