[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The Form_Open event does not trigger if event are handled in another class


Le 30/04/2026 à 14:20, Bruce Steers a écrit :

I have just noticed this when using gb.form.mdi Workspace

This is scenario....

Form1 has a Workspace object.

Form2 is the form to add to the workspace tabs.

Form2 has a Public Sub Form_Open() method that does some initialization.

I add a Form2 instance to the workspace in form1 Like so...

Dim f As Form2
f = New Form2
Workspace1.Add(f)

All is okay with that method.

But if i use "As" to monitor events with a handler in Form1 like this...

Dim f As Form2
f = New Form2 As "Form2"
Workspace1.Add(f)

Then the Form_Open() method  in Form2 is not run (nor Form_Close on exit)

I do not expect the sources "Form" events from From2 to be hidden from itself.

Is this a bug or just an unavoidable "Attach" thing i must code around?

Respects
BruceS

Of course, as if you write << AS "Form2" >>, then the event observer of Form2 is not itself anymore, but the object where you instanciate it.

Regards,

--
Benoît Minisini.