June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to clear all the input controls on a form.
Iterate recursively through the collection of controls, and clear the Text property whenever you find an input control.
You can iterate through the controls on a form using the Form.Controls collection, which includes all the controls that are placed directly on the form surface. However, if any of these controls are container controls (such as a group box, a panel, or a tab page), they might contain more controls. Thus, it’s necessary to use recursive logic that searches the Controls collection of every control on the form.
The following example shows a form that calls a ClearControls function recursively to clear all text boxes. Figure 11-4 ...
Read now
Unlock full access