question

Sergio-9977 avatar image
0 Votes"
Sergio-9977 asked Castorix31 answered

Use foreach for form button controls

To list all TextBoxes, do I need to list all controls?
Example
foreach (Control InitCtrl in this.Controls)

Can you be more specific?
Example
foreach (TextBox TxtBx in ?????)

Can it be done?
How?
Thanks

dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered

For example :

                 foreach (TextBox txtBox in this.Controls.OfType<TextBox>())
                 {
                     // code
                 }
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.