简体   繁体   中英

Remove/Hide duplicates from combobox

I have an application which has a datagrid which displays the data as the example below shows

        FundID ClientName FundName
          1      Client1    Arch1
          2      Client1    Build3
          3      Client2    Build2

In the data grid I have it displayed so that one client can have many funds. However I have a combobox to allow the user to filter the results by a certain client. My Problem is clicking on the combobox brings up a list like this

           Client 1
           Client 1
           Client 1
           Client 1
           Client 2
           Client 2
           Client 3

I want to have my combobox not to display the duplicates. , While I've seen a few code examples I was wondering are there any ways around it using the properties menu is vs2012 or any simple code methods

Just to clarify the issue a little more my main goal here is to find out is there a way I can use sql or some other way to edit what is displayed in the combobox while not effecting what is shown in the datagrid

Hey you can use group by at sql side. After using group by you will get only one name at time

group by ClientName

when you use group by you have to select only FundID and ClientName so you get unique name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM