C# Weird Bug when trying to remove Controls from Group Box -
i facing weird issue. want remove controls group box, not remove controls. seems bug on microsoft's end right now. tried many different techniques of removing these controls, none of them worked. have 2 other methods removing 1 control @ time (and no, cannot call in loop controls) , there works fine. have no idea issue be. knows way around this.
foreach (control c in fieldbox.controls) // not work, removes labels (i have 1 txt , 1 lbl) fieldbox.controls.remove(c); (int = 0; < fieldbox.controls.count; i++) // not work either fieldbox.controls.remove(fieldbox.controls[i]); (int = 0; < fieldbox.controls.count; i++) // still no success fieldbox.controls.removeat(i); (int = 0; < fieldbox.controls.count; i++) // nope fieldbox.controls.removebykey(fieldbox.controls[i].name); foreach (control c in fieldbox.controls) // final answer, outcome did not change fieldbox.controls.removebykey(c.name);
try decreasing counter , removing controls
for (int = fieldbox.controls.count - 1; >= 0; i--) // successful fieldbox.controls.removeat(i);
Comments
Post a Comment