sanlorenzo
asked on
Visual Studio 2008 Populate a Combo Box with Distinct Values
I have a Visual Studio 2008 Form
i have called frm_1
On the Form a have a Combo Box
i have called cbo_1
i have a dataset
i have called dataset1
link to a Table
i have called the table tbl_1
the Table have 4 Collums : ID_Name / Name / City / State /
I want use the Combo Box to pass a parameter to a Query that i want to develop
The query will filter by State ( but this question do not involve the Query , it related on how populate the Combo Box )
So what is the code to fill the cbo_1 with the States listed into the tbl_1 ( linked to the dataset1???
so the cbo_1 should list the state ( as unique value ) i mean i want be able to
Have unique state list on cbo_1
i have called frm_1
On the Form a have a Combo Box
i have called cbo_1
i have a dataset
i have called dataset1
link to a Table
i have called the table tbl_1
the Table have 4 Collums : ID_Name / Name / City / State /
I want use the Combo Box to pass a parameter to a Query that i want to develop
The query will filter by State ( but this question do not involve the Query , it related on how populate the Combo Box )
So what is the code to fill the cbo_1 with the States listed into the tbl_1 ( linked to the dataset1???
so the cbo_1 should list the state ( as unique value ) i mean i want be able to
Have unique state list on cbo_1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am assuming that you have the latest SP for Visual Studio 2008. You can use Linq to Object to create a list to feed the ComboBox as follows.
Open in new window