RemoveControl(control As WebUIControl) Removes the control from the WebPage

Hello all,

2024R4.1

Does the RemoveControl function set the object to Nil? Does it also remove it from the page right away?

I’ve found that setting an object to Nil does not necessarily remove it from the page. I stumbled across this function and want to be sure of how it works.

Thanks,
Tim

Each webcontrol is added to an array on the page so it won’t go out of scope if you don’t have your own reference. That’s the only way controls that are dragged onto a layout would ever work. So yes, the proper way to remove a control from a page is with the RemoveControl method. Just setting the item to nil, still leaves a reference in the internal array.

Thanks Greg.

And that goes for controls that are programmatically create and not dragged?

Also, does this go for Containers as well?

Tim

Anything that you add to a page that is a subclass of webcontrol.

Thank you!
Tim