|
-
May 27th, 1999, 04:33 AM
#1
Validating a field in a Dialog
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|