Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:12:14+00:00 2026-06-15T08:12:14+00:00

When I create & add a control to my WinForm using the designer, is

  • 0

When I create & add a control to my WinForm using the designer, is my control automatically added to a collection with all the others somewhere ?

Let’s say there are like 20 TextBox and I need to clear them all at the same time without calling it like so :

txtbox1.Clear();
txtbox2.Clear();
txtbox3.Clear();
...

I know I should have created manually each control without the designer and add them in a collection but it’s too late for that now. So any idea if I can access the whole group of controls ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:12:15+00:00Added an answer on June 15, 2026 at 8:12 am

    try this

    private void ClearTextBoxes()
    {
     Action<Control.ControlCollection> func = null;
    
     func = (controls) =>
         {
             foreach (Control control in controls)
                 if (control is TextBox)
                     (control as TextBox).Clear();
                 else
                     func(control.Controls);
         };
    
     func(Controls);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We separate features in our database using schemas. For example, all Create & Maintain
I'm using repo & git (http://source.android.com/source/version-control.html). I've started a new repo branch for 2
How to add a control in a window at run time using perl win32::GUI?
I create post POST https://maps.googleapis.com/maps/api/place/add/json?sensor=false&apiKey HTTP/1.1 Content-Type: application/json Host: maps.googleapis.com Content-Length: 100 Expect: 100-continue
I'm trying to create Listview control with two column using bellow code. LV_COLUMN lvc
We need to create & destroy instances of QApplication, as we want to use
I am trying to create & save images from data in an email from
this call my $th = threads->create(\&print, Hello thread World!\n); $th->join(); works fine. But as
I wanted to create jquery plugin & started off creating a sample jquery plugin...But
How can I create a New project & Solution in the same, existing ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.