Avatar

Correct answer by
Level 10

Hi,

The addInstance has a parameter 'true' or '1', for example:

form1.Page5.instanceManager.addInstance(1);

This will add another instance of Page5.

Now when it comes to removeInstance, the parameter that you need is the instance number that you want to delete, based on the zero-numbering system. For example if there are three instances of Page5, these are numbered Page5[0], Page5[1] and Page5[2]. So this script will remove the first instance:

form1.Page5.instanceManager.removeInstance(0);

If there is a button on Page 5 to delete the page, then you could pass this.parent.index as the parameter.

form1.Page5.instanceManager.removeInstance(this.parent.index);

However bear in mind that if the button is in subforms you will need multiple 'parent' to get to Page5: this.parent.parent.parent.index.

Hope that helps,

Niall

View solution in original post