I want all of my dynamically build controls away of my panel
but when i do this:
and i return to my form the controls are still thereCode:Me.Pnl_step3.Controls.Clear()
what i'm doing wrong??
Printable View
I want all of my dynamically build controls away of my panel
but when i do this:
and i return to my form the controls are still thereCode:Me.Pnl_step3.Controls.Clear()
what i'm doing wrong??
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()
thx
i tried this but the result is still the same
Do you know another solution??
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.
owkay thx
i think i've found the problem probably my array isn't empty when i reload the page