Removing controls in runtime

Stanl3yCZ

Member
Is it possible to remove some control in runtime? I need to remove it, not just make it invisible. Thanks.
 

willisgt

Active Member
Licensed User
You should dispose of the control using one of two methods:

1. If you created the control in the designer and know the name, you can dispose of it in this manner:

Textbox1.Dispose

2. If you create the control dynamically, you'll have to keep track of the name of the control until you want to dispose of it:

AddLabel( formName, controlName, left, top, width, height, text )
...
Control( controlName ).Dispose


Gary
 
Top