How to add constructor for a window

According to the LR, I can have a constructor for a window.
It doesn’t say ONLY subclassed windows but any.
The eventhandler list for this window doesn’t have a constructor.
How do I get a constructor?

Create a method named constructor in the window, along with any parameters you want to pass to it.

Call the window with

dim n as new yourwindow youwindow(param1, param2 ).show //etc.

Not exactly
if you have defined a constructor with parameters you should write:
dim w as new yourWindow(param1, param2)

So I added the constructor method to the DLGWndow window and I’ve tried a couple of lines already that don’t work.


DLGWndow(1) DLGWndow.ShowModal

They all say essentially too many parameters. They also all look funny for a constructor.

in your example:
dim w as new DLGWndow(1)

I was working on that one, but since I have implicit instance on, that didn’t seem right.

Thanks. Antonio. Posted as you posted.

Dim w As New DLGWndow(1) w.ShowModal

Implicit instance means that you can call:
DLGWndow.something and automatically it will be like:
dim w as new DLGWndow

but you can still use the call I have said.

Moreover if you have an implicit use then better keep (define) also a constructor without parameters

Yes. You can do that or not.

It also means I can create another instance of DLGWndow by writing


That is because the constructor doesn’t have to be called (just as you wrote).
I need to add that empty constructor.