Solved

calculate dbcurrencyedits

Posted on 2007-03-30
5
225 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
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Limbeck
Comment Utility
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
Comment Utility
that is too much work ...
I'd like to calculate 'on the fly' ...
0
 
LVL 19

Accepted Solution

by:
Limbeck earned 125 total points
Comment Utility
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
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now