>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.
That should fail at runtime because Controls.Count is off by one. This code works (at least in my simple test code):
int controlsCount = this.Controls.Count - 1;
for (int i = controlsCount; i >= 0; i--)
{
if ((string)this.Controls[i].Tag == "removable")
{
this.Controls.RemoveAt(i);
}
}