Results 1 to 7 of 7

Thread: Formatting a combo box to include a heading.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    27

    Formatting a combo box to include a heading.

    Greetings everyone,

    Is there a way to format a combo box so that the data returned from the database can have a heading. Example:


    ID Name
    1 Franks
    2 Jane

    So basically, programming in the heading information before the data is returned. The only data return from the database is ID numbers and Names, not the heading. Lastly, I did not to use a Rich Textbox because the user needs to make a selection in order to perform deletion. Thank in advance.

  2. #2
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: Formatting a combo box to include a heading.

    Quote Originally Posted by franconomic View Post
    Greetings everyone,

    Is there a way to format a combo box so that the data returned from the database can have a heading. Example:


    ID Name
    1 Franks
    2 Jane

    So basically, programming in the heading information before the data is returned. The only data return from the database is ID numbers and Names, not the heading. Lastly, I did not to use a Rich Textbox because the user needs to make a selection in order to perform deletion. Thank in advance.
    What is your query for the database?
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    27

    Re: Formatting a combo box to include a heading.

    The query is select * all. Then I just simply selected to use the columns that I want to use...

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Formatting a combo box to include a heading.

    Quote Originally Posted by franconomic View Post
    The query is select * all. Then I just simply selected to use the columns that I want to use...
    This is a bad practice. If you don't need all the data, why query for all? It's a waste of resources.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Formatting a combo box to include a heading.

    Doesn't make a lot of sense... if the header gets displayed in the combo, it bcomes selectable... plus, does the user really need to see the ID? I would think they would be more interested in the name part. I would set the displaymember to the name, the valuemember to the id, then set the combo's datasource to your datatable... then the user gets the very nice name Col in the display... and you get the ID value when using the .Value property.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Formatting a combo box to include a heading.

    Comboboxes are not designed to display tabular data. If you want to show your data in tabular format, use another control that is more suited, such as a datagridview.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Formatting a combo box to include a heading.

    Normally I'd agree... but I have seen (and used) multi-column drop downs before... they are handy when you need them... but this is a case where it's not needed.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width