[dba-VB] C# Filtered Combos

Gustav Brock Gustav at cactus.dk
Thu Mar 25 05:38:29 CDT 2010


Hi John

You are doing it right and you will end up with three icons per source.
If that bothers you, you will notice that the code for creating these are held in the designer code of the form. They can be moved to the code module if you like, and then the icons will not be present.

Here is an example where a predefined dataset is used:

<code>
    public partial class FormMain : Form
    {
        public DataSetDL DlDataSet = new DataSetDL();
    <snip>
        public FormMain()
        {
            InitializeComponent();
            InitializeDataSet();
            InitializeFolders();
        }
    <snip>
        private void FillEmployerComboBox()
        {
            DataSetDL.DataTableEmployerDataTable dataTableEmployer = DlDataSet.DataTableEmployer;
            EmployerComboBox.SelectedItem = "Id";
            EmployerComboBox.DisplayMember = "Organisation";
            EmployerComboBox.DataSource = dataTableEmployer;
        }
    <snip>
    }
</code>

InitializeDataSet fills the datasets from an XML file.

/gustav


>>> jwcolby at colbyconsulting.com 25-03-2010 02:45 >>>
I am trying to filter a bound combo when another combo changes selection.  I have to tell you this 
is overwhelming my tiny mind.  My form is bound and I have three combos also bound.  There must be a 
DOZEN objects down in the foot of my form - datasets, binding sources, tableadapters and binding 
navigators.  Too much stuff.  It's like each bound object drags along three different things just to 
make it work.

Am I doing this right?  Which piece would I modify to change the sql that changes the data displayed 
in the filtered combo?
-- 
John W. Colby
www.ColbyConsulting.com 






More information about the dba-VB mailing list