Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clearing a portion of a Form
Message
 
To
10/04/2009 16:52:48
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Application:
Desktop
Miscellaneous
Thread ID:
01394032
Message ID:
01394276
Views:
59
This message has been marked as the solution to the initial question of the thread.
>>Well I tried this

>>for (int i = this.Controls.Count; i >= 0; i--)
>>{
>>if ((string)this.Controls[i].Tag == "removable")
>>{
>>this.Controls.RemoveAt(i);
>>}
>>}

>>and still no luck. The count is always equal to 1.

Please try this one:
            List<Control> lstCtrl2Remove = new List<Control>();
            foreach( Control ctrl2Chk in this.Controls )
                if (ctrl2Chk.Tag != null && ctrl2Chk.Tag.ToString() == "removable")
                    lstCtrl2Remove.Add( ctrl2Chk );

            foreach( Control ctrl2Remove in lstCtrl2Remove )
                ctrl2Remove.Visible = false;   // this.Controls.Remove( ctrl2Remove )
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform