Click to See Complete Forum and Search --> : CEdit control update


Adrian Mongeli
May 12th, 1999, 09:43 PM
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
DigicodeSys@earthlink.net

Dan Haddix
May 13th, 1999, 02:05 AM
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

chiuyan
May 13th, 1999, 11:01 AM
Can't you just say:

GetDlgItem (IDC_My_Edit)->GetWindowText (MyString);

--michael

Nathan Cocker
May 13th, 1999, 11:10 AM
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.