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. Debug Assertion & Combo Box?

Debug Assertion & Combo Box?

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebuggingquestion
5 Posts 4 Posters 1 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

    Hi, I have two Dialog boxes, Dialog1 and Dialog2. I need to populate a Combo Box in Dialog2 from Dialog1. When I use the following lines in Dialog1 it compiles without error. CDialog2 ob; ob.m_cComboBox.ResetContent(); However when I run it (and when it reaches the 2nd line above)I get a Debug Assertion Failure in File: afxwin2.inl at line 741 which is this line. { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } The Combo Box properties are, Type: Dropdown, Owner draw: Variable Thanks in advance for any help, Aoife

    G N 2 Replies Last reply
    0
    • A Aoife

      Hi, I have two Dialog boxes, Dialog1 and Dialog2. I need to populate a Combo Box in Dialog2 from Dialog1. When I use the following lines in Dialog1 it compiles without error. CDialog2 ob; ob.m_cComboBox.ResetContent(); However when I run it (and when it reaches the 2nd line above)I get a Debug Assertion Failure in File: afxwin2.inl at line 741 which is this line. { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } The Combo Box properties are, Type: Dropdown, Owner draw: Variable Thanks in advance for any help, Aoife

      G Offline
      G Offline
      Ganesh Ramaswamy
      wrote on last edited by
      #2

      chk whether both dialog boxes r created. looks like one dialog is not created and the other is trying to fill the combo box of that uncreated dialog

      1 Reply Last reply
      0
      • A Aoife

        Hi, I have two Dialog boxes, Dialog1 and Dialog2. I need to populate a Combo Box in Dialog2 from Dialog1. When I use the following lines in Dialog1 it compiles without error. CDialog2 ob; ob.m_cComboBox.ResetContent(); However when I run it (and when it reaches the 2nd line above)I get a Debug Assertion Failure in File: afxwin2.inl at line 741 which is this line. { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } The Combo Box properties are, Type: Dropdown, Owner draw: Variable Thanks in advance for any help, Aoife

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        Aoife wrote: CDialog2 ob; ob.m_cComboBox.ResetContent(); This will naturally cause problems. The MFC object has been created. But the window it wraps has not been created yet [in this case, it's the dialog window] Do this instead. Use DoModal to bring up the dialog and put the combo box reset line in it's OnInitDialog function. Regards Nish


        The posting stats are now in PDF:- http://www.busterboy.org/codeproject/ Feel free to make your comments. Updated - May 04th, Saturday

        A 1 Reply Last reply
        0
        • N Nish Nishant

          Aoife wrote: CDialog2 ob; ob.m_cComboBox.ResetContent(); This will naturally cause problems. The MFC object has been created. But the window it wraps has not been created yet [in this case, it's the dialog window] Do this instead. Use DoModal to bring up the dialog and put the combo box reset line in it's OnInitDialog function. Regards Nish


          The posting stats are now in PDF:- http://www.busterboy.org/codeproject/ Feel free to make your comments. Updated - May 04th, Saturday

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

          Thanks but that isn't going to be much good to me because later in Dialog1 I need to .AddString() to the ComboBox. I guess what I'll have to do is write the items that need to be put into the ComboBox to a file in Dialog1 and then read them from the file when Dialog2 is opened and put them into the ComboBox.:~ Thanks for your help anyway. Aoife

          N 1 Reply Last reply
          0
          • A Aoife

            Thanks but that isn't going to be much good to me because later in Dialog1 I need to .AddString() to the ComboBox. I guess what I'll have to do is write the items that need to be put into the ComboBox to a file in Dialog1 and then read them from the file when Dialog2 is opened and put them into the ComboBox.:~ Thanks for your help anyway. Aoife

            N Offline
            N Offline
            Niklas L
            wrote on last edited by
            #5

            ...or use a CStringArray member in Dialog2, which you fill from dlg1. In Dialog2::OnInitDialog, fill your combo from the array.

            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