Solved

why does not this work

Posted on 2007-03-26
3
173 Views
Last Modified: 2010-04-05
procedure TPostavke.SpeedButton1Click(Sender: TObject);
var a,b,c: integer;
begin
if TryStrToInt(dbedit8.text,a) and TryStrToInt(edit40.Text,b) and TryStrToInt(edit50.text,c) then
  c:= a - b;

end;
0
Comment
Question by:Vrtnar
  • 3
3 Comments
 
LVL 28

Expert Comment

by:TName
ID: 18792794
It should work, but are you sure you want to test if c is an integer...?
a and be should be integers, c could be empty, you overwrite it's value anyway,


procedure TPostavke.SpeedButton1Click(Sender: TObject);
var a,b,c: integer;
begin
if TryStrToInt(dbedit8.text,a) and TryStrToInt(edit40.Text,b) then
  c:= a - b;
 
ShowMessage(IntToStr(c));
end;
0
 
LVL 28

Expert Comment

by:TName
ID: 18792812
>if c is an integer
I mean if edit50.Text is an integer (and dbedit8.Text and edit40.Text...)    ;)
0
 
LVL 28

Accepted Solution

by:
TName earned 50 total points
ID: 18794067
Or du you want to display the result in edit50?
Then you should try something like:

procedure TPostavke.SpeedButton1Click(Sender: TObject);
var a,b,c: integer;
begin
  if TryStrToInt(dbedit8.text,a) and TryStrToInt(edit40.Text,b) then begin
    c:= a - b;
    edit50.Text:=IntToStr(c);
  end;
end;
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

14 Experts available now in Live!

Get 1:1 Help Now