Dialog Data Validation

You can specify validation in addition to data exchange by calling DDV functions, as shown in the example in Dialog Data Exchange. The DDV_MaxChars call in the example validates that the string entered in the text-box control is not longer than 20 characters. The DDV function typically alerts the user with a message box if the validation fails and puts the focus on the offending control so the user can reenter the data. A DDV function for a given control must be called immediately after the DDX function for the same control.

You can also define your own custom DDX and DDV routines. For details on this and other aspects of DDX and DDV, see MFC Technical Note 26.

The Add Member Variable Wizard will write all of the DDX and DDV calls in the data map for you.

See also

Dialog Data Exchange and Validation
Working with Dialog Boxes in MFC
Dialog Data Exchange