combobox and duplicate items

I have a combobox that contains some items of one feild in database,,
some items are duplicate in that feild,
is there any method to remove the duplicate names in the combobox?
Who is Participating?
JassimiConnect With a Mentor Author Commented:
I got the solution..
connect the combobox to the datasource from properties,
go to dataset designer from Solution Explorer
right click on the DataAdapter and choose configure..
you can adjust the SQL Statement or you can go to query builder to select the column that you want to make it Distinct
you can execute query to test that
after that click finish
All duplicate data will removed from the combobox
TimCotteeHead of Software ServicesCommented:
Hello Jassimi,

Easiest to remove the duplicates in the retrieval process from the database.

Using something like "Select Distinct MyField From MyTable" to eliminate duplicates before binding to the dropdown.


JassimiAuthor Commented:
I don't want to remove it from the database..
I just want to remove it from the combobox
TimCotteeHead of Software ServicesCommented:

That doesn't remove it from the table, simply selects only distinct values. It has no effect on what is stored there, just the values that are bound to the dropdown.

JassimiAuthor Commented:
can you tell me how to that exactly,
because I connect this combobox through properties, I just chose the datasource and displaymember,

can I select the distinct values from properties,
tell me step by step
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.