?
Solved

sum up currencyedits

Posted on 2007-03-27
12
Medium Priority
?
165 Views
Last Modified: 2010-04-05
I have about 10 currencyedit's and would like to sum them up in one currencyedit.
How and what would be the best way ?
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
  • 7
  • 5
12 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 200 total points
ID: 18800221
name them consecutively like this edtCurr1, edtCurr2, ..edtCurr10, and
use the FindComponent method like this:

var
  i: Integer;
  c: Extended;
  e: TEdit;
begin
  c := 0.0;
  for i := 1 to 3 do
  begin
    e := TEdit(FindComponent('edtCurr'+ IntToStr(i)));
    c := StrToFloat(e.Text) + c;
  end;
  Edit4.Text := FloatToStr(c);
end;
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18800233
oops, change the for to 1 to 10.
and change Edit4.Text to edtCurr11.Text

only had 3 on my form for testing.
0
 

Author Comment

by:Vrtnar
ID: 18800565
any alternatives to renaming ??
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Vrtnar
ID: 18800681
I raised an exception class... RConvert error - ''' is not a valid floating value
when I tried your suggestion...
Does not work...
0
 

Author Comment

by:Vrtnar
ID: 18800797
It seems that when the value of the currencyedit is 0,00 €
then the exception is raised...
0
 

Author Comment

by:Vrtnar
ID: 18800821
it seems I must set  zeroempty = False of the curredits to get this thing to work...
0
 

Author Comment

by:Vrtnar
ID: 18800904
eddie...I have made this work by changing the zeroempty thinggie...
Is there a way to update the currency13 (the one that sums up)
when onchange of the currencyedits occur without having to write
every single onchange event of each curredit??
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18801435
You can set them all to the same OnChange event to do the computation.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18801444
Or if you have other code in the Onchange events, write a separate method to do the change and
call it from each of them.
0
 

Author Comment

by:Vrtnar
ID: 18801564
"You can set them all to the same OnChange event to do the computation" -
can you give me an example,please...??
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18802479
if you have one OnChange event, set the OnChange event for ALL your edits to the same
event handler in th eObject Inspector, use the dropdown and select the correct handler.
0
 

Author Comment

by:Vrtnar
ID: 18803900
well..I learn something new in Delphi every day...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 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