What parameter has controls.remove() method in winforms? I want to remove some element from a form. What should I pass into the remove method – its id or something else?
What parameter has controls.remove() method in winforms? I want to remove some element from
Share
The
controlsproperty is aControl.ControlCollection. To remove a control from this collection, you need to pass in an instance of the control you want to remove.The MSDN docs has an example:
To answer the question in your comment:
You cannot remove it by its id or name, but you can find the instance of your control by passing its name into the
Findmethod on theControlsproperty. This returns as array of all controls that have the specified name.