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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shubham rastogi
    New Member
    • Dec 2010
    • 6

    #1

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

    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
  • bentleyw
    New Member
    • Feb 2008
    • 32

    #2
    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.

    Comment

    Working...