Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2018, 02:52 AM
sktamrkar sktamrkar is offline
Member
 
Join Date: Oct 2013
Posts: 71
Default Verhoeff algorithm implementation

I am from india. I make a small application that have a edit box to enter aadhar number and a button to check the number entered is valid or not. Plz help where to put code of verhoeff algorithm and how to use this cide on button click.




Thnx
Sandeep kumar
Reply With Quote
  #2  
Old 08-09-2018, 12:43 PM
rojam rojam is offline
Senior Member
 
Join Date: Jun 2015
Posts: 191
Default

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.
Reply With Quote
  #3  
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
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:09 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.