-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Stacey Verner
Sent: Monday, 13 November 2000 09:15
To: Multiple recipients of list delphi
Subject: [DUG]: Encrypting a Password in OnSetText, and OnGetText.


I have a database field, that contains an encrypted password. I want to do
something like the following to decrypt the string when I read it from the
dataset,and encrypt it when writing to the dataset, but this doesn't work. I
type in the string. Press save and it comes up blank.

procedure TfEMailOptions.DecryptPassword(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
    inherited;
    Text := DecryptString(Text);
end;


procedure TfEMailOptions.EncryptPassword(Sender: TField;
        const Text: String);
begin
    inherited;
    Sender.AsString := EncryptString(Text);
end;

Any suggestions?


==============
You have to set DisplayText according to whether it is just displayed or
edited. Normally in these handlers when using them to format the text for
editing I set DisplayText to false. Also I did not call an inherited
handler. I do not know if there is one because this is an event procedure
and the code in the TField that calls the event handler has, presumably,
done any inherited stuff that it needs to.

======================================================================
Patrick Dunford, Christchurch, NZ - http://patrick.dunford.com/
Support the Right To Life - http://www.right-to-life.org/

   A man who lacks judgment derides his neighbor, but a man of
understanding holds his tongue.
    -- Proverbs 11:12
http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20001112
======================================================================

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to