Solved

calculate dbcurrencyedits

Posted on 2007-03-30
5
233 Views
Last Modified: 2010-04-05
I am having problems calculating witd dbcurrency edit.
Example:
procedure TPostavke.Edit51Change(Sender: TObject);
var a: Currency;
 b: integer;
begin
if TryStrToCurr(currencyedit37.Text,a) and TryStrToInt(edit51.text,b) then
edtCurr11.value:= a * b ;
end;

This works but if I replace currencyedit37 with a dbcurrencyedit it will not work and it beats me why not.
To go over this how can I display a value of a currency field from a database in currencyedit
depending on the row i click in the grid (contact I select in grid)?Can you tell me alsohow  to calculate 2 dbcurrencyedits?
0
Comment
Question by:Vrtnar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Limbeck
ID: 18822451
im not completely following you but here goes.

first of all you should use dbedit instead of edit. Connect the dbedit to the same datasource as your dbgrid.

instead of using the onchange use a calculated field and use that as a datafield of the dbedit you want to show the result in.

search your help files "calculated field"  for details.

good luck
Ed
0
 

Author Comment

by:Vrtnar
ID: 18822810
that is too much work ...
I'd like to calculate 'on the fly' ...
0
 
LVL 19

Accepted Solution

by:
Limbeck earned 125 total points
ID: 18822869
then try something like

if (not yourdbcurrencyedit.Field.isNull) and TryStrToInt(edit51.text,b) then
edtCurr11.value:=yourdbcurrencyedit.Field.AsCurrency*b
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21156532
Forced accept.

Computer101
EE Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 386
Comparing dates in Delphi. Greater than/ Less than 3 344
Help on project with Soap 10 67
Correct Component for Shopping Cart. 2 131
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question