By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,368 Members | 1,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,368 IT Pros & Developers. It's quick & easy.

How to display two columns sequently in combobox using display member property?

P: 6
I am using a combobox.. and I want to display two columns combobox using the diplay member property...for example I have a table sam and it has two columns A and B .


following are details of column A

A

---

1

2

3



following are the details of column B


B

---

4

5

6




Now I want to display them into combobox as following...


1

2

3

4

5

6
Dec 17 '10 #1
Share this Question
Share on Google+
1 Reply


bentleyw
P: 32
I'm not sure where you're getting your data. But assuming that this is data from a database and you're querying it, then you could write a UNION query with a SELECT for each column. If you need to do it client side, then you could build a new DataTable with one column and populate it either iteratively or using LINQ. Then the DisplayMember of the ComboBox would be the column name from the table, and set the table as the DataSource.
Dec 18 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.