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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. the Clear() function

the Clear() function

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 Posts 4 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.
  • E Offline
    E Offline
    Eversman
    wrote on last edited by
    #1

    Hey, I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected. How do I get it to clear all of them? Here is the code: void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.Clear(); m_type2.Clear(); m_type3.Clear(); m_type4.Clear(); m_type5.Clear(); } Thanks for any help

    A F E N 4 Replies Last reply
    0
    • E Eversman

      Hey, I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected. How do I get it to clear all of them? Here is the code: void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.Clear(); m_type2.Clear(); m_type3.Clear(); m_type4.Clear(); m_type5.Clear(); } Thanks for any help

      A Offline
      A Offline
      Anthony_Yio
      wrote on last edited by
      #2

      Try this

      // The pointer to my combo box.
      extern CComboBox* pmyComboBox;

      // Delete every other item from the combo box.
      for (int i=0;i < pmyComboBox->GetCount();i++)
      {
      pmyComboBox->DeleteString( i );
      }

      Sonork 100.41263:Anthony_Yio Life is about experiencing ...

      1 Reply Last reply
      0
      • E Eversman

        Hey, I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected. How do I get it to clear all of them? Here is the code: void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.Clear(); m_type2.Clear(); m_type3.Clear(); m_type4.Clear(); m_type5.Clear(); } Thanks for any help

        F Offline
        F Offline
        Frank K
        wrote on last edited by
        #3

        Hi, try this //clears all enteries from the combo box //MFC MyCombo.ResetContent(); //API SendMessage(MyComboHwnd, CB_RESETCONTENT, 0, 0); HTH Frank

        1 Reply Last reply
        0
        • E Eversman

          Hey, I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected. How do I get it to clear all of them? Here is the code: void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.Clear(); m_type2.Clear(); m_type3.Clear(); m_type4.Clear(); m_type5.Clear(); } Thanks for any help

          E Offline
          E Offline
          Eversman
          wrote on last edited by
          #4

          Thanks guys that worked. How about an editbox, that is ready only, and it displays the text of a combo box, I tried the clear() function there too, but it doesn't work. Any ideas? Thanks

          F 1 Reply Last reply
          0
          • E Eversman

            Thanks guys that worked. How about an editbox, that is ready only, and it displays the text of a combo box, I tried the clear() function there too, but it doesn't work. Any ideas? Thanks

            F Offline
            F Offline
            Frank K
            wrote on last edited by
            #5

            Hi, //MFC MyEdit.SetSet(0, -1); MyEdit.Clear(); //API SendMessage(MyEditHwnd, EM_SETSEL, 0, -1); SendMessage(MyEditHwnd, WM_CLEAR, 0, 0); HTH Frank

            1 Reply Last reply
            0
            • E Eversman

              Hey, I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected. How do I get it to clear all of them? Here is the code: void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.Clear(); m_type2.Clear(); m_type3.Clear(); m_type4.Clear(); m_type5.Clear(); } Thanks for any help

              N Offline
              N Offline
              Naren Neelamegam
              wrote on last edited by
              #6

              use this code... void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.ResetContent(); m_type2.ResetContent(); m_type3.ResetContent(); m_type4.ResetContent(); m_type5.ResetContent(); } enought to clear all ur combo contents okay;) Hava nice day with regards loveablevirus

              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