Preventing an Invalid Entry
-
How do you prevent someone from entering an invalid entry? For instance, the user can enter a "y" or "Y". If they entered anything else, they would receive a message saying invalid entry and be given the chance to re enter their input. I am using Microsoft Visual C++.
-
How do you prevent someone from entering an invalid entry? For instance, the user can enter a "y" or "Y". If they entered anything else, they would receive a message saying invalid entry and be given the chance to re enter their input. I am using Microsoft Visual C++.
One way could be...
BOOL bOK = FALSE;
CyourDialog newDlg;
do
{
if (IDCANCEL == newDlg.DoModal ())
break;if ((newDlg.yourParameter == "y") || (newDlg.yourParameter == "Y"))
{ bOK = TRUE;
break;
else
AfxMessageBox ("The entry is not valid, please give a correct value");
}while (bOK == FALSE)Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson