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

  • Home
  • SEARCH
  • 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 9247691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:47:40+00:00 2026-06-18T09:47:40+00:00

I’m currently working on a small side project as a way of getting used

  • 0

I’m currently working on a small side project as a way of getting used to Forms in Visual Studio 2012, as I usually only work with Console Applications. My current layout is designed to use tabs, and the user is to specify how many of the tabs they need for this application. They then fill out some information and it will be formatted and output to a file at a location specified by the user. On to the questions.

In order to stop duplicate tabs from existing, I’m using the following:

private void comboTabs_SelectedIndexChanged(object sender, EventArgs e)
{
    if (comboSkills.SelectedIndex == 0)
    {
        tabControl1.TabPages.Remove(tab8);
        tabControl1.TabPages.Remove(tab7);
        tabControl1.TabPages.Remove(tab6);
        tabControl1.TabPages.Remove(tab5);
        tabControl1.TabPages.Remove(tab4);
    }
    //repeat for Index 1, 2 and so on
}

There will always be a minimum of 3 tabs, so the first selection on the combo box removes tabs 4 through 8. The next selection does the same, but then adds tab4 back again. This goes on for the following selections. Is there any way I can do this more conveniently?

Second question, each tab has a series of text boxes and combo boxes that users are to select information from. The problem I’m having is that I need to identify how many tabs the user has selected and then only pull information from those tabs. I’m aware that I can get the number of tabs with:

int numberoftabs = tabControl1.TabCount;

But after that I can’t seem to read the information from them. I’m intending to do

for (int i = 0; i < numberoftabs; i++)
{
    //get textbox text of tab i and so on            
}

Is there any way I can do this? I was hoping to use a tab layout since I like my current layout very much. If it makes a difference, all the tabs have the same layout, and share a naming convention such as tab 1 text box 1 is textTab1Name, tab 2 text box 2 is textTab2Name and so on.

  • 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-18T09:47:42+00:00Added an answer on June 18, 2026 at 9:47 am

    For the first part of your question, you can handle all cases with this piece of code:

    var tabCount = 5 - comboBox1.SelectedIndex;
    
    for (var i = 0; i < tabCount; i++)
    {
        tabControl1.TabPages.RemoveAt(7-i);
    }
    

    For the second part you will have to create this method:

    private T GetControl<T>(string name) where T : Control
    {
       return (T) this.Controls.Find(name, true).FirstOrDefault();
    }
    

    Then you can write your text retrieval loop like this:

    for (int i = 0; i < numberoftabs; i++)  
    {
        //get textbox text of tab i and so on            
        TextBox textBox1 = GetControl<TextBox>("textTab" + i + "Name");
        ...
        etc..
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a small JavaScript validation script that validates inputs based on Regex. I
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all

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.