locked
what does !m_bSaveAndValidate do RRS feed

Answers

  • When set to true, you are reading the data from the screen controls and putting it into your local data structure.  (Inside the do data exchange)  Then you can validate the data once it's in the local variable.

    When it's false, it's usually the other way around.  (data->controls)

    When you call UpdateData(TRUE) it sets m_bSaveAndValidate to true.  UpdateData forces a DoDataExchange to be called.

    Sometimes you need to validate data coming from a control before it is assigned to local variables. 

    if (pDX->m_bSaveAndValidate) //transferring data from control to data

    {

         CString csTitle;

          m_editTitle.GetWindowText(csTitle);

          if ((m_eGender == eGenderMale) && (csTitle != "Mr."))

          {

              //throw error.

           }

    }

     

    • Marked as answer by daiyueweng Friday, December 17, 2010 6:36 PM
    Friday, December 17, 2010 5:58 PM