UpdateData,是用来刷新数据的。
RemarksThe framework automatically calls UpdateData with bSaveAndValidate set to FALSE when a modal dialog box is created in the default implementation of . The call occurs before the dialog box is visible. The default implementation of calls this member function with bSaveAndValidate set to TRUE to retrieve the data, and if successful, will close the dialog box. (If the Cancel button is clicked in the dialog box, the dialog box is closed without the data being retrieved.)
UpdateData(TRUE) -- 刷新控件的值到对应的变量
UpdateData(FALSE) -- 拷贝变量值到控件显示例如,窗口中用 DDX_Text(pDX, IDC_EDIT1, m_usercode); 将IDC_EDIT1编辑框控件与m_usercode变量做了关联,如果修改m_usercode之后要想对应控件显示更改,则需要调用UpdateData(FALSE);反之在IDC_EDIT1的oneditchanged()中需要加入UpdateData(TRUE);
Updatedata(FALSE) == 将成员变量的值赋值给控件;
//
如果你为控件分配了变量
UpdateData(true)
是使用户输入的数据能够反映到变量上
在函数调用之后变量才被赋值
UpdateData(false)
是当你给控件对应的变量赋过值之后,在控件上体现出来
在函数调用之前,控件的值是不会随变量变化的