Solved

calculate dbcurrencyedits

Posted on 2007-03-30
5
226 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 139
delphi exception 7 61
FMX enumerated colours 2 84
Making delphi communicate with a c# service 16 88
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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

912 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

16 Experts available now in Live!

Get 1:1 Help Now