TilakGopi
Hi,
This is excerpt from MSDN-
If the user cancels a modal dialog box, the OnCancel member function terminates the dialog box and DoModal returns the value IDCANCEL. In that case, no data is exchanged between the dialog box and the dialog object.
But if the user pressess OK button, data exchange will be done first and then the dialog will closed.This is the basic difference between OK and Cancel buttons.
How to set to my ok button the same as cancel button behavior (close the dialog).
for this u can modify ur code as follows
[code language="c++]
int nResponse = dlg.DoModal();
switch
( nResponse )
{
case IDOK:
dlg.EndDialog(IDOK);
break;
case IDOK2:
{
UpdateData(TRUE);
dlg.EndDialog(IDOK2);
//dlg.CloseWindow();
break;
}
default:
break;
};
[/code]
Hope , ur doubt is cleared.
Thanx,
Ch.T.Gopi Kumar.