Calculated TEdit in a form

Hi everyone...

In a form I have, a TDBEdit object displays a numeric value from my table. I placed a TEdit object near it, on the same form, and I'd like to have it reflect that amount multiplied times 1.15.

How can I do it?
Can it display itself conditionally based on the value of a TDBCheckBox on the same form? (It's also the same table.)
How can I have an edit box to make the 1.15 modifiable by the user?

Thanks, best regards.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can use something like this to change the value:

procedure TForm1.Button2Click(Sender: TObject);
   PulsoOk:= InputQuery('hello',
      'please enter number...', Nombre);
   if PulsoOk
{save this number in variable or registry or ini file etc..}
  else ShowMessage('no number');

then TDBEdit onchange event do
edit1.text := strtoint(TDBEdit.text * variable you saved);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Eduardo1Author Commented:
We're almost there...!!!

What I have right now is this:

procedure TfrmDepartamentos.DBEdit5Change(Sender: TObject);
   if DBCheckBox1.Checked then

1. I need to insert a real type where the number 2 is, but there's no such thing as RealtoStr or StrtoReal.
2. When I get to a record where DBCheckBox1.Checked = True, the value doesn't show on the same record, but on the next one that appears on the form.

Thanks for your help.
ok i will see what i can do in a test later and let you know.

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

ahh i forget to convert real to string and string to real you can use FloattoStr() and StrToFloat() functions instead.

and for the value doesn't show on the same record maybe it will work better on the DBEdits OnEnter or OnExit events..
Eduardo1Author Commented:

I used the FloattoStr() and StrtoFloat() functions, and they worked great.

I placed the code:

   if DBCheckBox1.Checked then

in the DBNavigator OnClick event handler. Then I tested checking the checkbox on the first record, and when it didn't work I copied the code and added it to the FormCreate event. That did it!

Thanks inthe... you pressed the right buttons in my brain so we could both solve this.

I feel good...!
hehe no problem ,
glad to be of help ;-)
see you again
Regards Barry
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.