combobox and duplicate items

Posted on 2008-10-01
Last Modified: 2013-11-05
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?
Question by:Jassimi
  • 3
  • 2
LVL 43

Expert Comment

ID: 22612737
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.



Author Comment

ID: 22613133
I don't want to remove it from the database..
I just want to remove it from the combobox
LVL 43

Expert Comment

ID: 22613176

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.


Author Comment

ID: 22615295
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

Accepted Solution

Jassimi earned 0 total points
ID: 22637195
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Crystal Report for VS2013 17 71
Closing all open child forms. 4 38
VB.Net - Oracle BulkCopy from CSV Date Format 7 44
Help with LINQ and XML 10 25
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now