请问,UpdateData(true)和UpdateData(false)的区别是什么?什么时候用UpdateData(true),什么时候用UpdateData(false)?盼答复.

解决方案 »

  1.   

    BOOL UpdateData( BOOL bSaveAndValidate = TRUE );Return ValueNonzero if the operation is successful; otherwise 0. If bSaveAndValidate is TRUE, then a return value of nonzero means that the data is successfully validated.ParametersbSaveAndValidateFlag that indicates whether dialog box is being initialized (FALSE) or data is being retrieved (TRUE).ResCall this member function to initialize data in a dialog box, or to retrieve and validate dialog data.The framework automatically calls UpdateData with bSaveAndValidate set to FALSE when a modal dialog box is created in the default implementation of CDialog::OnInitDialog. The call occurs before the dialog box is visible. The default implementation of CDialog::OnOK 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.)
      

  2.   

    UpdateData(true)取对话框上空件的值,UpdateData(false)把值赋给取对话框上空件。
      

  3.   

    UpdateData(true)是将控件里的内容提出到你的与此控件相关的变量,UpdateData(false)是将变量上的值写到控件上
      

  4.   

    true表示将控件的显示值取回到关联的变量中
    false表示用关联的变量的值设置控件的显示值可通过ClassWizard将一个控件与一个变量关联