View Single Post
 
Old 08-20-2018, 03:26 AM
sktamrkar sktamrkar is offline
Member
 
Join Date: Oct 2013
Posts: 71
Default

Quote:
Originally Posted by rojam View Post
Here is an implementation of the verhoeff algorithm in Delphi.

You could call this function from the Edit's OnExit method, like so:
Code:
procedure TForm1.Edit1OnExit(Sender: TObject);
begin
  if trim(Edit1.Text) <> '' then
    if ValidVerhoeff(Edit1.Text) then
    begin
      //a valid number was entered
    end
    else
      Edit1.SetFocus;//reset focus back to the edit control
   end;
end;
since you can't enforce that Edit1 has any value in OnExit, you'll also need to add code to the Save (to a database / file or what ever you use to save the information) to ensure that the edit control has a value.
Thnx working with few modification.
Reply With Quote