Solved

combobox and duplicate items

Posted on 2008-10-01
5
557 Views
Last Modified: 2013-11-05
hi..
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?
0
Comment
Question by:Jassimi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 43

Expert Comment

by:TimCottee
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.

Regards,

TimCottee
0
 
LVL 2

Author Comment

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

Expert Comment

by:TimCottee
ID: 22613176
Jassimi,

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.

TimCottee
0
 
LVL 2

Author Comment

by:Jassimi
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
0
 
LVL 2

Accepted Solution

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

737 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