|
-
Feb 14th, 2010, 05:26 PM
#1
Thread Starter
Member
How do I delete/remove custom control from a form programmatically?
Hello I created a custom control and add it to a form programatically.
The user can add and move them all over the form.
The problem is when I want to clear the form of my user control I don't know how.
I created an array of my control called ctlCorkNotes
Say I create ctlCorkNotes(1) and now I want to delete it.
How do I do this so it is gone and would have to recreate it to show up again?
Thanks for your help.
Mythos
-
Feb 14th, 2010, 05:51 PM
#2
Fanatic Member
Re: How do I delete/remove custom control from a form programmatically?
First of all, set the visible property to false and then use this method:
ctlCorkNotes.Dispose()
That will release all resources to your control.
-
Feb 14th, 2010, 05:53 PM
#3
Re: How do I delete/remove custom control from a form programmatically?
 Originally Posted by Zeelia
First of all, set the visible property to false and then use this method:
ctlCorkNotes.Dispose()
That will release all resources to your control.
The Visible property is irrelevant. Call the control's Dispose method and then Remove it from its Parent's Controls collection.
-
Feb 14th, 2010, 06:10 PM
#4
Fanatic Member
Re: How do I delete/remove custom control from a form programmatically?
off-topic: I like irrelevance :P
No, but honestly I don't know why I wrote that..
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
|