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. Populating a ComboBox

Populating a ComboBox

Scheduled Pinned Locked Moved C / C++ / MFC
17 Posts 5 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.
  • N namy31

    Hello everyone, I m trying to populate my Combobox but i m not successfull as yet. as usuall I have enetred the data in properties DATA tab of ComboBox I tryed with insertstring and additem method also but nothing is working.At runtime my ComboBox expands blankly it does not show any data Thanx, namy.:(

    namy

    P Offline
    P Offline
    prasad_som
    wrote on last edited by
    #7

    namy31 wrote:

    as usuall I have enetred the data in properties DATA tab of ComboBox

    If you have entered string there, it should be semicolon(;) separated.

    Prasad Notifier using ATL | Operator new[],delete[][^]

    D 1 Reply Last reply
    0
    • P prasad_som

      namy31 wrote:

      as usuall I have enetred the data in properties DATA tab of ComboBox

      If you have entered string there, it should be semicolon(;) separated.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #8

      No semicolon is required. :confused:


      "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

      "Judge not by the eye but by the heart." - Native American Proverb

      P 1 Reply Last reply
      0
      • N namy31

        Hello everyone, I m trying to populate my Combobox but i m not successfull as yet. as usuall I have enetred the data in properties DATA tab of ComboBox I tryed with insertstring and additem method also but nothing is working.At runtime my ComboBox expands blankly it does not show any data Thanx, namy.:(

        namy

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #9

        namy31 wrote:

        I tryed with insertstring and additem method...

        What value are they returning?

        namy31 wrote:

        it does not show any data

        Exactly how are you verifying this?


        "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

        "Judge not by the eye but by the heart." - Native American Proverb

        N 1 Reply Last reply
        0
        • D David Crow

          No semicolon is required. :confused:


          "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

          "Judge not by the eye but by the heart." - Native American Proverb

          P Offline
          P Offline
          prasad_som
          wrote on last edited by
          #10

          DavidCrow wrote:

          No semicolon is required.

          In original post, he mentioned setting data using DATA field in properties window. There you have to insert data (;) separated. Let's say I want to display three items added initialy viz. "tom","dick" and "harry", you can add it in DATA field with (;) as separator; as "tom;dick;harry"

          Prasad Notifier using ATL | Operator new[],delete[][^]

          D 1 Reply Last reply
          0
          • P prasad_som

            DavidCrow wrote:

            No semicolon is required.

            In original post, he mentioned setting data using DATA field in properties window. There you have to insert data (;) separated. Let's say I want to display three items added initialy viz. "tom","dick" and "harry", you can add it in DATA field with (;) as separator; as "tom;dick;harry"

            Prasad Notifier using ATL | Operator new[],delete[][^]

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #11

            prasad_som wrote:

            There you have to insert data (;) separated.

            No you don't. Each item goes on a separate line. No semicolon is required. This is in the context of VC++ v6.


            "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

            "Judge not by the eye but by the heart." - Native American Proverb

            P 1 Reply Last reply
            0
            • N namy1

              I have used this as well as the other one bellow not at same time definitely char *names[3]; names[0] = "Joe"; names[1] = "Billy"; names[2] = "Bob"; for(int i=0;i<=2;i++) m_ctrldestcombobox.AddString((LPCTSTR)names[i]); ***************************************************************** m_ctrldestcombobox.InsertString(1, "SAP R/3"); m_ctrldestcombobox.InsertString(2, "PLM SERVER"); thanx pls reply even if i m acting foolishly

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

              I tested your code it was working,did you check return value of AddString what return value?

              _**


              **_

              WhiteSky


              1 Reply Last reply
              0
              • D David Crow

                namy31 wrote:

                I tryed with insertstring and additem method...

                What value are they returning?

                namy31 wrote:

                it does not show any data

                Exactly how are you verifying this?


                "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

                "Judge not by the eye but by the heart." - Native American Proverb

                N Offline
                N Offline
                namy1
                wrote on last edited by
                #13

                In my initdialog function I m using these function controls r initialized here for veryfying I just need to run my programm where I see the form I have created all other controls work fine but my conbobox shows no contents on clicking right corner it just expands to the designed size but doesnot show anythig Thanx for such quick and guiding responses namy1

                D 1 Reply Last reply
                0
                • D David Crow

                  prasad_som wrote:

                  There you have to insert data (;) separated.

                  No you don't. Each item goes on a separate line. No semicolon is required. This is in the context of VC++ v6.


                  "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

                  "Judge not by the eye but by the heart." - Native American Proverb

                  P Offline
                  P Offline
                  prasad_som
                  wrote on last edited by
                  #14

                  Ohh ! I was talking in VS 2005 context. :)

                  Prasad Notifier using ATL | Operator new[],delete[][^]

                  1 Reply Last reply
                  0
                  • N namy1

                    In my initdialog function I m using these function controls r initialized here for veryfying I just need to run my programm where I see the form I have created all other controls work fine but my conbobox shows no contents on clicking right corner it just expands to the designed size but doesnot show anythig Thanx for such quick and guiding responses namy1

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #15

                    Is the combobox "tall" enough? The default height is way too small.


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    N 1 Reply Last reply
                    0
                    • D David Crow

                      Is the combobox "tall" enough? The default height is way too small.


                      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                      "Judge not by the eye but by the heart." - Native American Proverb

                      N Offline
                      N Offline
                      namy1
                      wrote on last edited by
                      #16

                      Yes its quite long to accomodate atleast two items bcoz right now i m trying to display 2 items only is there ne way to send attachments i would send u the screen shots thanx namy1

                      D 1 Reply Last reply
                      0
                      • N namy1

                        Yes its quite long to accomodate atleast two items bcoz right now i m trying to display 2 items only is there ne way to send attachments i would send u the screen shots thanx namy1

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #17

                        Try sending them to davidcrow(at)peoplepc.com.


                        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                        "Judge not by the eye but by the heart." - Native American Proverb

                        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