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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:44:53+00:00 2026-05-19T13:44:53+00:00

I was just writing a windows application that populates three comboboxes from the same

  • 0

I was just writing a windows application that populates three comboboxes from the same datasource. My datasource is a datatable.

The way i populate the comboboxes is by repeating the following code for each of the comboboxes:

'populate 1st combobox
cbx1.DataSource = table
cbx1.DisplayMember = "someColumn"
cbx1.ValueMember = "anotherColumn"
cbx1.SelectedIndex = Indx

'populate 2nd combobox
cbx2.DataSource = table
cbx2.DisplayMember = "someColumn"
cbx2.ValueMember = "anotherColumn"
cbx2.SelectedIndex = Indx

'populate 3rd combobox
cbx3.DataSource = table
cbx3.DisplayMember = "someColumn"
cbx3.ValueMember = "anotherColumn"
cbx3.SelectedIndex = Indx

When the application is run, and I select an item from the dropdown list of, say, cbx1, my choice is reflected in cbx2 and cbx3 as well. I find this behaviour strange and will be grateful if anybody could explain what is going on here behind the scenes.

On a side note, I’ve been able to circumvent this problem by modifying my code as shown below, but would still like to have an explanation for this seemingly strange behaviour.

'populate 1st combobox
Dim t1 as datatable = table.Copy
cbx1.DataSource = t1
cbx1.DisplayMember = "someColumn"
cbx1.ValueMember = "anotherColumn"
cbx1.SelectedIndex = Indx

'populate 2nd combobox
Dim t2 as datatable = table.Copy
cbx2.DataSource = t2
cbx2.DisplayMember = "someColumn"
cbx2.ValueMember = "anotherColumn"
cbx2.SelectedIndex = Indx

'populate 3rd combobox
Dim t3 as datatable = table.Copy
cbx3.DataSource = t3
cbx3.DisplayMember = "someColumn"
cbx3.ValueMember = "anotherColumn"
cbx3.SelectedIndex = Indx
  • 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-05-19T13:44:53+00:00Added an answer on May 19, 2026 at 1:44 pm

    The behaviour is not so strange – you have three combo boxes all bound to the same data source, so when you select a value in the first combo box, you are changing the index of the current record in the underlying data source – since the other two combo boxes are bound to this, they will update also.

    Edit: Behind the scenes, the reason for the behaviour is to do with how data binding is implemented in the .Net framework – see this question for a more detailed explanation.

    As you have discovered, the solution is to use separate data sources for each combo box. There is a related question here which you may find interesting.

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

Sidebar

Related Questions

I'm writing an application that is basically just a preferences dialog, much like the
I am about to start on a journey writing a windows forms application that
I have just been getting into low level programming (reading/writing to memory that sort
I'm writing a program that contains a generational garbage collector. There are just two
I'm re-writing a legacy Windows application using Python and running on Linux. Initially, the
I'm writing a windows application in c#,FW3.5 & Visual Studio 2008. I need to
I'm writing a Windows application. How can I tell when a screenshot is being
What am I trying to achieve? I am writing a windows-form based application in
We're writing a Windows client application in VB.NET. On the first launch of the
I am writing a windows form application in .net using C#. I am running

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.