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. Emptying editbox

Emptying editbox

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 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.
  • B Offline
    B Offline
    BoudewijnEctor
    wrote on last edited by
    #1

    Hi, I've got a CEdit control, and a CString --> the CString will contain CEdit's text after de DDX_TEXT call, but after this I need the CEdit to be empty. I've tried by emptying the string, and then calling UpdateData(), but that just fills the string with the content of the CEdit, instead of the other way around. How can I do this?

    C D V 3 Replies Last reply
    0
    • B BoudewijnEctor

      Hi, I've got a CEdit control, and a CString --> the CString will contain CEdit's text after de DDX_TEXT call, but after this I need the CEdit to be empty. I've tried by emptying the string, and then calling UpdateData(), but that just fills the string with the content of the CEdit, instead of the other way around. How can I do this?

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      Try calling UpdateData(FALSE). The parameter is used to control the direction of data transfer. TRUE -> data from window to CString FALSE -> data from CString to window. Chris Meech "what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002. Oh and for those that ask programming questions in the lounge. Seek the truth here[^].

      B 1 Reply Last reply
      0
      • B BoudewijnEctor

        Hi, I've got a CEdit control, and a CString --> the CString will contain CEdit's text after de DDX_TEXT call, but after this I need the CEdit to be empty. I've tried by emptying the string, and then calling UpdateData(), but that just fills the string with the content of the CEdit, instead of the other way around. How can I do this?

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

        Since UpdateData() is an all-or-nothing operation, it shouldn't be used on individual updates.

        m_edit.SetWindowText("");

        1 Reply Last reply
        0
        • B BoudewijnEctor

          Hi, I've got a CEdit control, and a CString --> the CString will contain CEdit's text after de DDX_TEXT call, but after this I need the CEdit to be empty. I've tried by emptying the string, and then calling UpdateData(), but that just fills the string with the content of the CEdit, instead of the other way around. How can I do this?

          V Offline
          V Offline
          Vitali Halershtein
          wrote on last edited by
          #4

          Hi again student ;P MSDN BOOL UpdateData( BOOL bSaveAndValidate = TRUE ); Return Value Nonzero if the operation is successful; otherwise 0. If bSaveAndValidate is TRUE, then a return value of nonzero means that the data is successfully validated. In other words: TRUE -> from screen, FALSE -> to screen :cool: Other way: set up text directly in the Edit similar: m_myEdit.SetWindowText(youStringHere); Hope this help. Vitali

          1 Reply Last reply
          0
          • C Chris Meech

            Try calling UpdateData(FALSE). The parameter is used to control the direction of data transfer. TRUE -> data from window to CString FALSE -> data from CString to window. Chris Meech "what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002. Oh and for those that ask programming questions in the lounge. Seek the truth here[^].

            B Offline
            B Offline
            BoudewijnEctor
            wrote on last edited by
            #5

            Thank you, it really helped

            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