Hello ,
I am having a problem with validating a field.
Problem Description :
I am having a Simple Dialog With One Edit control ( Name ) and Ok and Cancel Buttons.Initially When the dialog is activated I am setting the focus to Name. On the Killfocus of Name I am Validating the name. If the validation is failed I am showing the message and again setting the focus to Name. My Problem is even the user presses the Cancel button , Killfocus of Name is called and focus is set to Name and dialog is not closed. Please help me. Code is void CTestDialog::OnKillfocusName( )
{
UpdateData( TRUE ) ;
if (ValidateName(m_strName) == FALSE)
{
AfxMessageBox("Enter a valid name.");
CWnd *ptrName = GetDlgItem(IDC_EDIT_NAME) ;
ptrName->SetFocus() ;
}
}




Please Help Me. Thanks.

Kishore Kumar D
Bangalore.
India.