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 9307223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:20:52+00:00 2026-06-19T00:20:52+00:00

I am currently working with visible attributes on textboxes. Below I copy pasted a

  • 0

I am currently working with visible attributes on textboxes. Below I copy pasted a snippet of my code. I have several textboxes in my form. It is going to become very tedious trying to write it as I have below for all the textboxes. Is there a way to compress my code to a few lines to make the textboxes visible?

    public void makeVisible()
    {
        textBox1.Visible = true;
        textBox2.Visible = true;
        textBox3.Visible = true;
        textBox4.Visible = true;
        //etc.

    }
  • 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-19T00:20:53+00:00Added an answer on June 19, 2026 at 12:20 am

    Try this:

    foreach(Control c in Controls)
    {
     TextBox tb = c as TextBox;
     if (tb !=null) tb.Visible = false; //or true, whatever.
    }
    

    For limited textboxes:

    int count = 0;  
    int txtBoxVisible = 4;  
    foreach(Control c in Controls)
    {
        if(count <= txtBoxVisible)
        {
            TextBox tb = c as TextBox;
            if (tb !=null) tb.Visible = false; //or true, whatever.
            count++;
        }
    }
    

    You can set txtBoxVisible according to your need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working with visible attributes on textboxes. Below I copy/pasted a snippet
I currently have working code to save children to a parent entity. But I'm
I have been working on making a form that uploads an image through ajax
I am currently working on a visualization using d3.js. Please have a look here
I am currently working on a project where we have a couple very control
In the application I'm currently working on, there's a case where I have 2
I'm rewriting some code that works into code that's currently not working. Basically, I
I'm currently working on a website and in my mainContent div i have 5
I am currently working on syntax highlighting and code completion project, and making user
Currently i am working tabbar application in Android. here i mentioned the code for

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.