Solved

combobox and duplicate items

Posted on 2008-10-01
5
552 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
  • 3
  • 2
5 Comments
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

11 Experts available now in Live!

Get 1:1 Help Now