CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    12

    CEdit control update

    I am familiar how UpdateData(FALSE) updates all the controls in a dialog.

    However, what if you just want to update a single CEdit control? Is there a way to do that? Can you provide some sample code?

    Thank you for the help!
    - Adrian

    Adrian Mongeli
    [email protected]

  2. #2
    Join Date
    May 1999
    Posts
    82

    Re: CEdit control update

    OK I'm not sure if this will work, but it's worth a try. Since CEdit is derived from CWnd you may be able to call UpdateData(FALSE) on the control directly instead of the whole dialog like so....

    m_edit1.UpdateData(FALSE);

    Let me know if this actually works


  3. #3
    Join Date
    May 1999
    Location
    Seattle, WA USA
    Posts
    423

    Re: CEdit control update

    Can't you just say:

    GetDlgItem (IDC_My_Edit)->GetWindowText (MyString);

    --michael


  4. #4
    Join Date
    May 1999
    Posts
    2

    Re: CEdit control update

    UpdateData works with the dynamic data exchange mechanism. What you need to do is put an edit control onto a dialog and the from the member variables tab of classwizard, create a member variable for the edit control. Make it a CString. Now what you can do is use UpdateData to transfer the data to and from the member variable to the edit control. UpdateData(TRUE) retrieves data from the edit control and back to the member variable. UpdateData(FALSE) initialises the edit control with the data in the member variable.

    Once you master the use of UpdateData you can have dialogs being updated with various types of data on button presses or any kind of handled event.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured