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
Solved

calculate dbcurrencyedits

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 324
Delphi and Access based Enumeration 9 70
scroll down TListBox component in Delphi 1 19
MS Access from Delphi 31 60
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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