I am converting an Access frontend/SqlServer2000 backend application into a .Net Windows Forms application. I am using SqlCommand/SqlDataReaders/stored procs to load my data into a class then into the form's controls rather than using a DataAdapter. Don't know if this is the best approach, but I already had the logic, classes and stored procs so I opted to use them in the .Net app. (My transaction tables and activity tables have millions of records in them) Also, my roots are developing in Microsoft Access so I have reservations about binding forms and controls to the tables. It may no longer be an issue with .Net

I also have a single table in SqlServer that holds all the items that are used to populate the multitude of combo boxes used throughout the app (based on a code ie: mmb, prm, typ, cty, etc).

Each location may have as many as 10 users and a form may have as many as 10 combo boxes. (Note: each location has it's own server and a replicated copy of the database)
So..... my question is:
1. Do I bind each combo box to a DataSet
2. or do I populate each combo box with an Array
3. If I use an Array, do I hit the SqlServer for EACH combo box to load the data into its Array
4. or do I hit the SqlServer once for each form and load only the arrays for the combo boxes on that form

Again, binding 10 combo boxes to a single table may not be an issue in .Net

Re: Visual Basic Language Should I bind my combo boxes to a dataset? Or use an Array?


Since you already have custom classes to load your data into, you should probably just bind a BindingSource to your object and then bind the ComboBoxes to the BindingSource. I assume from the description that each combobox displays the value of a property on the custom class. I would load the class(es) appropriate to the given form and then bind to the class(es).

Don't be affraid of databinding - it is extremely powerful when done correctly and using BindingSource objects makes it pretty easy to do correctly.

Using DataSets and TableAdapters can be a real time saver for most database access. Custom classes may still be preferrable if you're applying business logic at the data level (which sometimes makes sense to do).

Re: Visual Basic Language Should I bind my combo boxes to a dataset? Or use an Array?


I have the same doubt too...Is there any property to use to bind a dataset to a combo box control in a windows application just like web application Can somebody send a sample code.

Re: Visual Basic Language Should I bind my combo boxes to a dataset? Or use an Array?


Please visit the 101 Samples for Visual Studio 2005 page at

Download the Windows Forms Samples pack

The topic "Using BindingSource for static and dynamic data including objects" should give you a good start.

Hope that helps.