ID Number Validation

  1. We want to design an application which requires the user to input his/her ID number for validation.
  2. When the application starts, it shows a message in the edit box to prompt the user typing an ID number. At this moment, the button is disabled.
  3. If the input string length is not 10 characters, the button should not be enabled.
  4. If the first character is not an English alphabet, or the other nine characters are not digits, the string is certainly not a valid ID number.
  5. The second character should be either 1 or 2. Otherwise, it is invalid.
  6. For the abovementioned invalid input, the button should not be enabled.
  7. When the button was clicked, it automatically converts the input string to uppercase by the MakeUpper() member function of CString, and apply this rule to validate the ID number.

Correct ID
Incorrect ID