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. RE: Set ComboBox Values ?

RE: Set ComboBox Values ?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
6 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.
  • A Offline
    A Offline
    Aoife
    wrote on last edited by
    #1

    Hello, Sorry for posting this a second time. I'm using MFC dialog based app. In it I have two dialog boxes Dialog1 and Dialog2. There is a Combo Box in Dialog2 that I want to populate with integer values obtained from Dialog1. I know that I must use ResetContent() and InsertString(). But what I don't know is how to use them from Dialog1. The ComboBox has a control variable in Dialog2 but when I call this in Dialog1 I get errors. (I have included the header files). The following explains what I want to do. Dialog1.cpp #include "Dialog2.h" clear all contents from the Combo Box in Dialog2 while (number < 10) { ... if(some condition) { write whatever the 'number' value is to the combo box in Dialog2 } ... number++; } Does anyone know how I can do this or know of any document explaining this. Thanks in advance, Aoife

    S 1 Reply Last reply
    0
    • A Aoife

      Hello, Sorry for posting this a second time. I'm using MFC dialog based app. In it I have two dialog boxes Dialog1 and Dialog2. There is a Combo Box in Dialog2 that I want to populate with integer values obtained from Dialog1. I know that I must use ResetContent() and InsertString(). But what I don't know is how to use them from Dialog1. The ComboBox has a control variable in Dialog2 but when I call this in Dialog1 I get errors. (I have included the header files). The following explains what I want to do. Dialog1.cpp #include "Dialog2.h" clear all contents from the Combo Box in Dialog2 while (number < 10) { ... if(some condition) { write whatever the 'number' value is to the combo box in Dialog2 } ... number++; } Does anyone know how I can do this or know of any document explaining this. Thanks in advance, Aoife

      S Offline
      S Offline
      Sonu Kapoor
      wrote on last edited by
      #2

      Could you tell us which Error you got !! Maybe then somebody can help you . Cheers Sonu

      A 1 Reply Last reply
      0
      • S Sonu Kapoor

        Could you tell us which Error you got !! Maybe then somebody can help you . Cheers Sonu

        A Offline
        A Offline
        Aoife
        wrote on last edited by
        #3

        In Dialog2 the ComboBox public control variable is m_cCombo. In Dialog1 when I call m_cCombo.ResetContent(); I get told error C2065: 'm_cCombo' : undeclared identifier error C2228: left of '.ResetContent' must have class/struct/union type In Dialog1.cpp I have included Dialog2.cpp

        S 1 Reply Last reply
        0
        • A Aoife

          In Dialog2 the ComboBox public control variable is m_cCombo. In Dialog1 when I call m_cCombo.ResetContent(); I get told error C2065: 'm_cCombo' : undeclared identifier error C2228: left of '.ResetContent' must have class/struct/union type In Dialog1.cpp I have included Dialog2.cpp

          S Offline
          S Offline
          Sonu Kapoor
          wrote on last edited by
          #4

          you must create an object of that class to use the combobox. try this: CDialog2 ob; ob.m_cCombo.ResetContent(); Best Regards Sonu

          A 1 Reply Last reply
          0
          • S Sonu Kapoor

            you must create an object of that class to use the combobox. try this: CDialog2 ob; ob.m_cCombo.ResetContent(); Best Regards Sonu

            A Offline
            A Offline
            Aoife
            wrote on last edited by
            #5

            Thanks. That has worked in that now I get no errors when I compile. But when It runs I get a debug assertion failure in File afxwin2.inl at this line (741) { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } Does this have something to do with the properties of the ComboBox? Thanks for you help. Aoife

            S 1 Reply Last reply
            0
            • A Aoife

              Thanks. That has worked in that now I get no errors when I compile. But when It runs I get a debug assertion failure in File afxwin2.inl at this line (741) { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } Does this have something to do with the properties of the ComboBox? Thanks for you help. Aoife

              S Offline
              S Offline
              Sonu Kapoor
              wrote on last edited by
              #6

              check the resource id for the control and for the window... Best Regards Sonu

              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