how to create a dynamic drop down list in C# with window forms


I'm trying to build a simple inventory program for a friends cellphone store I want to use C# and access database to store the data

the DB will have 2 main lists:

<ol><li><strong>devices</strong> - brand, model, color, price, stock,min_stock</li> <li><strong>parts</strong> - brand, model, description,stock,min_stock</li> </ol>

the GUI will use several drop lists brand will give me : samsung, htc, ect'.... model will give me : I9000,i9100,ect...

the two main problems I have when I try to think how to make it are this:

<ul><li>Each time new brands and models appear so i need an option to add a new model/brand to the database and then update the drop down list to have them automatically </li> <li>The drop lists needs to be connected so if I choose brand A only brands A models will appear in the model drop list</li> </ul>


First of all: don't use Access, use SQL Server 2008 Express. But that's only personal taste.

What you need to do to achieve what you want: Create a typed dataset in Visual Studio that contains one table for brands and one for models. Associate the two tables using a relation on the brand column.

Read both tables from the database - first the brands table, then the models table. Otherwise you'll get an error.

Create a master/detail binding for both lists. To do so, drop two BindingSource instances to your form. Associate one of them to the "brands" list and one to the "devices" list. The datasource for the "brands" BindingSource must be set to the brands table in the dataset, the datasource for the other BindingSource must be set to the <strong>relation</strong> between the two tables. All of this can be one in the designer.

If you have problems setting up the bindings, google for "C# master detail binding dataset".

<strong>EDIT</strong><br /> Another option - if the database connection is fast - would be to fill the list of brands from the database and whenever a brand is selected, clear and re-fill the list of models from the database on the fly using the selected brand name.


  • Java ArrayList Item Counter ie “Apple, 3×Banana, 2×Orange”
  • Updating a row in a data file with values from another row
  • How to avoid the redefinition of a function (PEP8 error F811)
  • Orange Python data load error: “example of invalid length”
  • database disk image is malformed or file is encrypted or is not a database
  • How to get the current URL using wordpress (including index and category pages)
  • android: can get location with LocationManager with Samsung Galaxy S2 in 30 seconds
  • Samsung phones and Notification.FLAG_INSISTENT bug?
  • How to get average values for time intervals in Postgres
  • Mozilla firefox ver 53 doesn't show “Device” option in “Responsive Design Mode”
  • Duplicate Entries in DB
  • How to increase the python speed over loops?
  • inserting duplicate records with SQL
  • Test-Path / System.IO.Directory::Exists not working as expected
  • How to determine location of a perl warning - Use of each() on hash after insertion
  • segfault from C stack overflow
  • i can't add #region to .ashx in visual studio 2010
  • How to silently drop a request in Tomcat?
  • How to enable Drag a Marker (Android Map Api v2) after a single Touch?
  • Can't get LogCat (Alcatel OneTouch Evolve)
  • Recreate Apple Watch fitness tracker ‘progress’ bar - gradient on CAShapeLayer stroke
  • how to drop column from table if exists
  • How to calculate total across columns but one?
  • Can't access Tomcat 7 Manager app when running from Eclipse
  • Layout design help Android
  • Client side validation mvc dropdown
  • Pre-populated SQLite Database not reading properly in Android Studio
  • Android custom URI scheme incorrectly encoded when type in browser
  • Deploying a CodeRush plugin from the Community Site
  • Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)
  • How to override value that appears in a dropdown in the rails_admin gem
  • Can I programmatically choose the Android layout folder?
  • How can the INSERT … ON CONFLICT (id) DO UPDATE… syntax be used with a sequence ID?
  • QLPreviewController hide print button in ios6
  • Ionic 2 storage is not cleaning up on uninstall - Only for signed APK
  • Linq Objects Group By & Sum
  • Uncaught Error: Could not find module `ember-load-initializers`
  • Optimizing database types to compact database (SQLite)
  • Buffer size for converting unsigned long to string
  • reshape alternating columns in less time and using less memory