[RESOLVED] Remove control during runtime?
Hey there,
does anyone know how to remove a control during runtime? Not disable or make it invisible, i want to remove it all together, making it no longer existing.
Example:
What would the code be to delete a command button (named cmdButton) during runtime?
Thanks
Re: Remove control during runtime?
Unload but if the control is added to your form at designtime then you cant programmatcially unload it like you do with controls added at runtime. I may be wrong as I havent done that in years but should be correct.
Re: Remove control during runtime?
AFIK only objects loaded in runtime can be destroyed in runtime, whats wrong with just hiding it?
Re: Remove control during runtime?
You're correct rob. Only controls that are created via Load can be deleted at runtime.
Re: Remove control during runtime?
Re: [RESOLVED] Remove control during runtime?
FYI: For anyone that cares. One annoying exception to being able to unload what you load dynamically.... You cannot unload objects from within a combobox click event, or from within any routines/functions called during the process of the click event. Try it; should get an error saying you can't unload "in this context".
If you ever get caught in that situation, use a timer, activate the timer as the last statement in the combo's click event, and on the timer's event unload the control. Just a tidbit worthy of keeping in the back of your mind so you don't go loony if it happens to you.
Re: [RESOLVED] Remove control during runtime?
lol thanks for the advice, that will probably come in handy