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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:10:15+00:00 2026-06-03T06:10:15+00:00

I am creating a windows form app with the following goal: get a list

  • 0

I am creating a windows form app with the following goal:

get a list of products, each with a unique name and a category (from an enumerated list) from a user (and then do some things after, but this is not relevant to the question).

The idea is I would like to have the user specify they would like to configure “n” products by entering a value in a text box. I have the event handler for the text box calling a method which sets a variable to this value n. This value, “n”, will be used as the loop counter, or what have you – the point is it will create the bound for the number of boxes to create.

I would then like to add (dynamically based on n), n number of (text box / combo box) pairs to the form. If there is no room to add another (text box / combo box) pair below the last one created, it should create another column.

n is unbounded, but, realistically, will likely never exceed 20. In any event, I’d like to be able to handle it if there are more products than this.

the options in the combo box will be filled from a string list that is passed in at run time, but will be consistent per box, per instance of this Form application.

i tried to enter a mock up image but stack overflow won’t let me until i have earned some reputation points 🙁

I understand how to create a number of boxes using something like the code below, but its the finer points i’m stuck on. Can anyone help?

thanks!

`        private void Method1()
        {
            int boxes = Int32.Parse(NumProducts.Text);
            for (int i = 0; i < boxes; i++)
            {
                TextBox tb = new TextBox();
                tb.Location = new System.Drawing.Point(40, i * 20);
                tb.Name = "TextBoxName" + i.ToString();
                tb.Size = new System.Drawing.Size(184, 20);
                tb.TabIndex = i + 2;
                tb.Text = String.Empty;
                panel1.Controls.Add(tb);

            }
        }

        private void NumProducts_TextChanged(object sender, EventArgs e)
        {
            Method1();
        }`
  • 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-03T06:10:16+00:00Added an answer on June 3, 2026 at 6:10 am

    Sounds to me like a DataGridView would be the better choice here. You can configure it with a DataGridViewTextBoxColumn as the first column and a DataGridViewComboBoxColumn for the second. It supports a “new row” as the last item.

    Read the docs. Drop one on a form and play with it.

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

Sidebar

Related Questions

Windows App - If i Hide() form A from itself, how do i Show()
When I'm creating a simple Windows form, is it starting in a new thread
Case : I'm creating an application (desktop application) with VB.NET (actually windows form), and
I'm using WPF for creating my application, I am calling a windows form using
I have a jQuery Model windows which contains a form. On creating of the
I am creating a Windows form application in C# which gets a set of
I'm creating a windows app in c# 2008 that will have around 8-10 dialog
I've written a simple WAV player in VB 2010 - a Windows Form App
I'm writing a c# windows app, and as one task, I am creating Panel
I am creating a windows application which required Dynamic Connection String in the app

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.