Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ComboBox - More than one Column

ComboBox - More than one Column

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RadioOpa
    wrote on last edited by
    #1

    Does anyone know whether you can have more than one Column in a CComboBox ? Seen this in an Access App. If yes: how to do ? Modified: Meant Column rather that row ! -- modified at 7:20 Monday 20th March, 2006

    N H 2 Replies Last reply
    0
    • R RadioOpa

      Does anyone know whether you can have more than one Column in a CComboBox ? Seen this in an Access App. If yes: how to do ? Modified: Meant Column rather that row ! -- modified at 7:20 Monday 20th March, 2006

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      What do you mean by more that one row in a combo box?


      Nibu thomas Software Developer

      R 1 Reply Last reply
      0
      • N Nibu babu thomas

        What do you mean by more that one row in a combo box?


        Nibu thomas Software Developer

        R Offline
        R Offline
        RadioOpa
        wrote on last edited by
        #3

        All right: a ComboBox keeps al lot of items listed while opened. I used ComboBoxes a lot so far. It´s content could look like this, just one row is keept by ComboBox Element and displayed: Fred Harry Paul Thomas I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas ACCESS is capable of holding more than one row in a ComoBox Element.

        N 1 Reply Last reply
        0
        • R RadioOpa

          All right: a ComboBox keeps al lot of items listed while opened. I used ComboBoxes a lot so far. It´s content could look like this, just one row is keept by ComboBox Element and displayed: Fred Harry Paul Thomas I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas ACCESS is capable of holding more than one row in a ComoBox Element.

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          RadioOpa wrote:

          I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas

          It is easy to display strings like this... When you add an item make sure you get the index to the item and then use CString's Format function.

          CString str;
          str.Format("%02d Fred", nIndex);
          m_cmb.AddString(str);//this should do it.

          Well to create multicolumn list box use LBS_MULTICOLUMN.


          Nibu thomas Software Developer

          R 1 Reply Last reply
          0
          • N Nibu babu thomas

            RadioOpa wrote:

            I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas

            It is easy to display strings like this... When you add an item make sure you get the index to the item and then use CString's Format function.

            CString str;
            str.Format("%02d Fred", nIndex);
            m_cmb.AddString(str);//this should do it.

            Well to create multicolumn list box use LBS_MULTICOLUMN.


            Nibu thomas Software Developer

            R Offline
            R Offline
            RadioOpa
            wrote on last edited by
            #5

            Thanks, but this is not a ListBox but a ComboBox. In a ListBox you can easily create more than one column and select items and it´s columns as m_Liste.InsertColumn( 0, "ID"); m_Liste.SetColumnWidth( 0, 40 ); m_Liste.InsertColumn( 1, "Customer"); m_Liste.SetColumnWidth( 1, 160 ); m_Liste.InsertColumn( 2, "Country"); m_Liste.SetColumnWidth( 2, 40); It appears that ComboBoxes do not support this feature so I need to format the string as suggested. I´ll use CString members as mid... for getting what I´m after.

            N 1 Reply Last reply
            0
            • R RadioOpa

              Thanks, but this is not a ListBox but a ComboBox. In a ListBox you can easily create more than one column and select items and it´s columns as m_Liste.InsertColumn( 0, "ID"); m_Liste.SetColumnWidth( 0, 40 ); m_Liste.InsertColumn( 1, "Customer"); m_Liste.SetColumnWidth( 1, 160 ); m_Liste.InsertColumn( 2, "Country"); m_Liste.SetColumnWidth( 2, 40); It appears that ComboBoxes do not support this feature so I need to format the string as suggested. I´ll use CString members as mid... for getting what I´m after.

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #6

              Yeah. You are right. Subclass the combobox. And then get hold of the list box inside the combo using OnCtlColor(See my reply to NS17 down). Now modify the style of the list box. Set it to have LBS_MULTICOLUMN style.


              Nibu thomas Software Developer

              1 Reply Last reply
              0
              • R RadioOpa

                Does anyone know whether you can have more than one Column in a CComboBox ? Seen this in an Access App. If yes: how to do ? Modified: Meant Column rather that row ! -- modified at 7:20 Monday 20th March, 2006

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                http://www.codeproject.com/combobox/SuperComboBox.asp[^] maybe it is some helpful to you

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups