Click to See Complete Forum and Search --> : UpdateData() Error


pkraman
May 2nd, 1999, 03:45 AM
hi,
i tried to call UpdateData function of Dialog box from its constructor and i got my favourite error "Assertion Failed". can't i call UpadateData function from the Constructor of the Dialog box. can any one explain this.

Thanks in Advance,
Kalyan

Alan Benett
May 2nd, 1999, 04:27 AM
Hello!

Calling member functions in a classes constructor usually causes an assertion failure, because i think the class has not yet been initialized completely. (Probably the constructors of the base-classes like CWnd etc. have to create the window first...)

What you should do is to put your initilization code in the OnInitDialog or OnInitialUpdate message handler.

Hope this helps.
Best regards.
Alan.