|
-
Oct 5th, 2007, 04:30 AM
#1
Thread Starter
Member
[RESOLVED] [2005] clear controls
I want all of my dynamically build controls away of my panel
but when i do this:
Code:
Me.Pnl_step3.Controls.Clear()
and i return to my form the controls are still there
what i'm doing wrong??
-
Oct 5th, 2007, 04:36 AM
#2
Re: [2005] clear controls
I can't tell you why your controls are still there because that code will clear all child controls from the specified container. It's my guess that you're specifying the wrong container.
That said, you have another problem there. By simply clearing the controls like that you are creating a resource leak. You MUST dispose all those controls before discarding them like that:
vb.net Code:
For Each ctl As Control In Me.Pnl_step3.Controls
ctl.Dispose()
Next ctl
Me.Pnl_step3.Controls.Clear()
-
Oct 5th, 2007, 04:40 AM
#3
Thread Starter
Member
Re: [2005] clear controls
thx
i tried this but the result is still the same
Do you know another solution??
-
Oct 5th, 2007, 05:09 AM
#4
Re: [2005] clear controls
There is no other solution required because there is no problem. The code provided will do EXACTLY what it's supposed to. Either you are not actually executing the code or else you're specifying the wrong Panel. You need to debug your code.
-
Oct 5th, 2007, 05:58 AM
#5
Thread Starter
Member
Re: [2005] clear controls
owkay thx
i think i've found the problem probably my array isn't empty when i reload the page
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
|