Shadowing a subclassed control built in property

I am working on a custom WebListBox. In order to keep the state of CheckBoxes, I am using a two dimensions area mirroring rows and columns. That works fine, until methods such as AddRow, Remove or insert are used. It would be great to know when these methods are used in order to update the array.

At the moment I am using a timer to periodically update, but that is not very elegant.

Is there any way somehow to override, hook or shadow the built in methods so any time they are called, the array can be updated ?

You can override methods in a subclass.
Just declare again Addrow in your subclass (with the same arguments of the original method) and then you will end calling your methods.
In your AddRow, insert Super.Addrow(…) to let the super class to do the original work.

Thank you Massimo.

But it does not seem to work. Or I did not quite understand what you posted.

I have a CustomListBox in which I have added AddRow(Item as String).

When I call CustomListBox1.Addrow("test") it does not call my AddRow but the native one.

There are two AddRow methods, check the docs. You must override the other one (or both).

Of course. Actually there seems to be only one.

Addrow(ParamArray Item() as String) catches Addrow(String) as it takes a single string as item(0). My error was to start with the single string item method.

Thank you so much, Massimo :slight_smile:

You are right. I didn’t properly read your OP, so I missed that you were speaking of a WebListbox.

FYI, when you add a method the Method Name field is a combobox that drops down to show all the methods you can override. Select one and the whole signature is filled in for you.

Great. Very convenient. Thank you.