Limiting a Bound ComboBox List Items

G

gleadams

I have databound a Windows form ComboBox control to a DataSource and
DataMember and it is properly showing the data as I navigate through
the records. My question concerns the choices in the pull-down list
itself.

The Field is Priority and the only available choices should be "High",
"Low", "Do Not Call".

These are the only choices I would like to see in drop-down, but
because it is bound to the column it is showing multiple instances of
each (based on the column it is tied to).

Question: How can data bind a combobox to a datacolumn, but still
retain control of what choices are available from the drop-down list.
(only one of each)

Thanks,
 
K

Kevin Spencer

You can ensure that there are no duplicates in the data source.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
R

RobinS

Do you mean that you are navigating through a dataset, and you are using
the column in the dataset itself to do the binding for the combobox?

If that is the case, you need to bind your database to a list containing
just the values you want displayed. Note that if you do this, when you
cross a record where the value is in your form's dataset but not in the
dropdown, the field will display as a blank. To get around that, you can
set it to a dropdown combobox, not a dropdown list, and load a list of
values directly into the combobox instead of binding it.

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top