|
-
Mar 5th, 2008, 12:03 PM
#1
Thread Starter
Lively Member
[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
-
Mar 5th, 2008, 12:06 PM
#2
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 5th, 2008, 12:09 PM
#3
Hyperactive Member
Re: Remove control during runtime?
AFIK only objects loaded in runtime can be destroyed in runtime, whats wrong with just hiding it?
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Mar 5th, 2008, 12:09 PM
#4
Re: Remove control during runtime?
You're correct rob. Only controls that are created via Load can be deleted at runtime.
-
Mar 5th, 2008, 07:05 PM
#5
Thread Starter
Lively Member
Re: Remove control during runtime?
-
Mar 5th, 2008, 07:18 PM
#6
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.
-
Mar 5th, 2008, 07:21 PM
#7
Thread Starter
Lively Member
Re: [RESOLVED] Remove control during runtime?
lol thanks for the advice, that will probably come in handy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|