Dialog Data Validation

HomeOverviewHow Do ISampleTutorial

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.

ClassWizard will write all of the DDX and DDV calls in the data map for you. Do not manually edit the lines in the data map between the delimiting comments.

See Also   Life Cycle of a Dialog Box, Dialog Data Exchange