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. Add custom defined ID to the ComboBox

Add custom defined ID to the ComboBox

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionc++
3 Posts 2 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.
  • W Offline
    W Offline
    willbin
    wrote on last edited by
    #1

    How to bind the custom defined ID together with the String when adding the String into the Combobox. Why do this? Cause I want to get the custom defined ID associated with the String but not the String. For example,

    ID

    TEXT

    13

    goods from 13th shop

    11

    goods from 11th shop

    ...

    ...

    The TEXT content is only for display, when selecting, the ID is wanted.(Because by using the ID, I can get more detailed infomation such as a list of goods.) But with MFC it is seems I can not associate the customed ID with the TEXT ,what is added into combobox when calling AddString method. Is the Combobox has any way to satisfy the requirement. If it has not, I have to build a map between customed IDs and the Combobox self-created IDs. //////////////////////////////

    N 1 Reply Last reply
    0
    • W willbin

      How to bind the custom defined ID together with the String when adding the String into the Combobox. Why do this? Cause I want to get the custom defined ID associated with the String but not the String. For example,

      ID

      TEXT

      13

      goods from 13th shop

      11

      goods from 11th shop

      ...

      ...

      The TEXT content is only for display, when selecting, the ID is wanted.(Because by using the ID, I can get more detailed infomation such as a list of goods.) But with MFC it is seems I can not associate the customed ID with the TEXT ,what is added into combobox when calling AddString method. Is the Combobox has any way to satisfy the requirement. If it has not, I have to build a map between customed IDs and the Combobox self-created IDs. //////////////////////////////

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

      Try SetItemData. :~


      Nibu thomas A Developer Programming tips[^]  My site[^]

      W 1 Reply Last reply
      0
      • N Nibu babu thomas

        Try SetItemData. :~


        Nibu thomas A Developer Programming tips[^]  My site[^]

        W Offline
        W Offline
        willbin
        wrote on last edited by
        #3

        Thank you for your help:laugh: //////////////////////////////

        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