M
Michael.Suarez
foreach (TextBox tb in this.Controls)
tb.Dispose();
What this does is clears every other textbox on the form.
Suppose there are 10 textboxes... this will dispose the 1st one, then i
guess whatever list of textboxes it's maintaining gets shifted, so the
2nd is now the 1st in the list, so when it goes to the next one, it is
destroying the 3rd textbox, leaving the 2nd one safe...
any better way to do this so that it destroys all 10 textboxes?
tb.Dispose();
What this does is clears every other textbox on the form.
Suppose there are 10 textboxes... this will dispose the 1st one, then i
guess whatever list of textboxes it's maintaining gets shifted, so the
2nd is now the 1st in the list, so when it goes to the next one, it is
destroying the 3rd textbox, leaving the 2nd one safe...
any better way to do this so that it destroys all 10 textboxes?