how to display two column value in combobox DisplayMember-VBForums
Results 1 to 17 of 17

Thread: how to display two column value in combobox DisplayMember

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    how to display two column value in combobox DisplayMember

    hi i'm having hard time on how to display two column values in combox display member..like custID and custName...any sample code plz help

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,843

    Re: how to display two column value in combobox DisplayMember

    That's because it's not possible. If you want to display multiple columns then you have to derive your own class and add that functionality. There are various examples on the web. Search for multicolumn combobox or the like and you'll find them.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    Re: how to display two column value in combobox DisplayMember

    Any sample code sir please!! So that i have a guide

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,843

    Re: how to display two column value in combobox DisplayMember

    I have no code examples. To find examples, I would have to search the web. You can do that just as easily as I can. They are out there because I've seen them before. Did you try at all?

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    Re: how to display two column value in combobox DisplayMember

    Yeah but it seem i havnt find the right way..just give me that link sir please

  6. #6
    Junior Member
    Join Date
    May 2007
    Posts
    23

    Re: how to display two column value in combobox DisplayMember


  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,843

    Re: how to display two column value in combobox DisplayMember

    Quote Originally Posted by crisjala View Post
    Yeah but it seem i havnt find the right way..just give me that link sir please
    What link? I already said that I didn't have any. All I can do is search, the same as you. Are you saying that you don't know how to search Google?

    http://lmgtfy.com/?q=multicolumn+combobox+.net

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    Re: how to display two column value in combobox DisplayMember

    Tnx ive seen it but
    i dont know the firstep on how to do this

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,843

    Re: how to display two column value in combobox DisplayMember

    Did you download the source files? Did you download the demo project?

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    Re: how to display two column value in combobox DisplayMember

    Yes sir

  11. #11

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    Re: how to display two column value in combobox DisplayMember

    Please give me the step of the process multicolumcombobox class...please

  12. #12
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,843

    Re: how to display two column value in combobox DisplayMember

    Quote Originally Posted by crisjala View Post
    Yes sir
    Then you already have everything you need. Import the class into your own project and away you go.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  13. #13
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Candon City, Ilocos Sur, Phils.
    Posts
    10,799

    Re: how to display two column value in combobox DisplayMember

    Can't you just combine your two columns in your sql and set it as the DisplayMember?

    Code:
    SELECT Column1 + ' ' + Column2 FROM table
    Regards,

    ô

    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  14. #14

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    62

    Re: how to display two column value in combobox DisplayMember

    TNX BUT THAT NOT WHAT I WANT TO DO
    THIS SOMETHING THAT I WANT TO TO DO IN THIS EXAMPLE http://www.codeproject.com/KB/combob...lumncombo.aspx BUT I DONT UNDERSTAND THE PROCESS OR STEP PROCESS

  15. #15
    New Member
    Join Date
    Apr 2011
    Posts
    1

    Re: how to display two column value in combobox DisplayMember

    @dee-u, Thatís too cool man thanks that will help a lot on other projects as well. @crisjala, some times the best way to learn is not to be given the answer but close that will help you not only find the answer but strengthen you over all knowledge. but if you must here is my code based on the cluse dee-u sugested and it works perfect.
    Code:
    SELECT first_name1 + ' ' last_name2 AS full_name FROM table
    Code:
    me.combobox1.displaymember = full_name
    works like a charme
    thank dee-u

  16. #16
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: how to display two column value in combobox DisplayMember

    Quote Originally Posted by crisjala View Post
    TNX BUT THAT NOT WHAT I WANT TO DO
    THIS SOMETHING THAT I WANT TO TO DO IN THIS EXAMPLE http://www.codeproject.com/KB/combob...lumncombo.aspx BUT I DONT UNDERSTAND THE PROCESS OR STEP PROCESS
    YELLING will get you less help. Not more.

    Edit: I just realized Weax bumped a year old thread. I doubt the OP is following it anymore.
    Last edited by Lord_Rat; Apr 8th, 2011 at 11:34 AM.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  17. #17
    New Member
    Join Date
    May 2012
    Posts
    1

    Re: how to display two column value in combobox DisplayMember

    Quote Originally Posted by weax1569 View Post
    @dee-u, Thatís too cool man thanks that will help a lot on other projects as well. @crisjala, some times the best way to learn is not to be given the answer but close that will help you not only find the answer but strengthen you over all knowledge. but if you must here is my code based on the cluse dee-u sugested and it works perfect.
    Code:
    SELECT first_name1 + ' ' last_name2 AS full_name FROM table
    Code:
    me.combobox1.displaymember = full_name
    works like a charme
    thank dee-u
    I've been hunting for a solution to accomplish this as well. Thanks guys!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.