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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:31:22+00:00 2026-06-16T02:31:22+00:00

I have 2 comboboxes in a form. I’d like the selected value in combobox1

  • 0

I have 2 comboboxes in a form.

I’d like the selected value in combobox1 to change when the list in combobox2 gets updated.

For Example: ComboBox1 has names of mobile companies and ComboBox2 containing the list of all mobile phones of that company.

  • 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-16T02:31:24+00:00Added an answer on June 16, 2026 at 2:31 am

    Assume you have a dictionary that associates phone models to their manufacturers:

    Dictionary<string, string[]> brandsAndModels = new Dictionary<string, string[]>();
    
    public void Form_Load(object sender, EventArgs e)
    {
        brandsAndModels["Samsung"] = new string[] { "Galaxy S", "Galaxy SII", "Galaxy SIII" };
        brandsAndModels["HTC"] = new string[] { "Hero", "Desire HD" };
    }
    

    You can get the items to be displayed in the left combo box as:

    foreach (string brand in brandsAndModels.Keys)
        comboBox1.Items.Add(brand);
    

    You do this only once, for example in the form’s Load event. Note: The brandsAndModels dictionary must be an instance variable, not a local variable as we need to access it later on.

    Then, you’d have to assign an event handler for the SelectedIndexChanged event, in which you replace the items in the second combo box with the items in the array for the selected brand:

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        comboBox2.Items.Clear();
    
        if (comboBox1.SelectedIndex > -1)
        {
            string brand = brandsAndModels.Keys.ElementAt(comboBox1.SelectedIndex);
            comboBox2.Items.AddRange(brandsAndModels[brand]);
        }
    }
    

    If all of this came from a database, things would be much nicer using data bindings as described in the answers to the question I’ve linked in my comment to your question.

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

Sidebar

Related Questions

I have two comboboxes on an form. Each has the values Yes and No.
i have some comboboxes and some textboxes on a form i would like to
I have a form with two ComboBoxes. The second ComboBox holds a list of
I currently have two comboboxes on a form. The first combobox contains a list
I have a windows form and user select cloth parameters from comboboxes like country-state-city
I need to build a form where I have 2 comboBoxes . Select country
I have a form in VB.Net with Autoscroll enabled and several ComboBoxes within it.
I have a Form with multiple different controls like ComboBox , TextBox and CheckBox
Im using c# .net windows form application. I have two comboboxes A and B
I have three ComboBoxes on my form. What is the event so that if

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.