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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:12:35+00:00 2026-06-12T01:12:35+00:00

I have a program that I am trying to write that one row of

  • 0

I have a program that I am trying to write that

one row of the comboboxes and text boxes are created dynamically when you click the plus button that is on the form
and then you can keep clicking the plus and it keeps adding a row but moves the new row down

I have the row organized like this:

there is a comboBox for buildings, then a comboBox for rooms. And that is one row

The building comboboxes have lists of buildings in them, and when I choose an item from the list, I need to populate the room combobox with the list of room numbers that correspond with the building.

I am having an extremely hard time doing this.
This is what Ive tried.

my row class is what I use to create the new rows.
When I press the button, a new row is created with new comboboxes etc.

Here is my event handler

private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
    {

        ComboBox comboBox = sender as ComboBox;
        if (comboBox.SelectedItem.Equals("ATLC"))
        {
            foreach (int x in row.ATLC)
            {
                row.roomComboBox.Items.Add(x);
            }
        }

Now my problem is I need to somehow add the corresponding room number data to the roomComboBox associated with the current row, and I dont know how and its driving me nuts.
The sender comboBox is associated with the current row, so is there a way to use the sender to reference the roomComboBox that is a member of the same row??
any help would be great. Ive searched lots of threads on here and cant seem to find an answer.

edit:

Is there a way to reference the object that a variable belongs to.
If I could somehow reference the row object of the sender comboBox then i might could use that to reference the room comboBox of the same row object…maybe? somehow? please?

  • 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-12T01:12:36+00:00Added an answer on June 12, 2026 at 1:12 am

    When you create your comboboxes for each row, you can set the Building combobox’s Tag property to the Room Numbers combobox. That will let you retrieve the associated combobox for that row. i.e…

    // create combobox for row N...
    ComboBox cmbBuilding = new ComboBox();
    ComboBox cmbRooms = new ComboBox();
    
    // store rooms combobox in building combobox
    cmbBuilding.Tag = cmbRooms;
    
    // ...
    
    private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
    {
      ComboBox comboBox = sender as ComboBox;
    
      // get the room combobox
      ComboBox cmbRooms = comboBox.Tag as ComboBox;
    
      if (comboBox.SelectedItem.Equals("ATLC"))
      {
        foreach (int x in row.ATLC)
        {
          cmbRooms.Items.Add(x);
        }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to write a program that alphabetizes strings. I have one
I have been trying, in vain, to make a program that reads text out
I have been trying to write a powershell program that checks to see if
I am trying to write one portion of my huge C# program that allows
I am trying to write a program that will create a text file and
I'm trying to write a program using MPI and I have a question that
I have a C++ program that writes to stdout that I am trying to
I have a c program that is trying to read in a file. Using
I have a calendar program that I am trying to convert to iPad (using
I have a small program that I'm trying to create to get ip addresses

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.