Solved

Syntax problem with if statement

Posted on 2000-04-21
6
196 Views
Last Modified: 2010-04-04
I have three edit boxes. Edit 1 2 and 3. what I'm trying to achieve is:-

If editbox 2 is equal or greater than Editbox 1 then edit box 3 equals nil. Else, Edit box 3 equals Edit box 1 less Edit Box 2.

What ever I do I can't get the syntax right.

Many thanks

Nick
0
Comment
Question by:NickRackham
  • 4
  • 2
6 Comments
 
LVL 1

Expert Comment

by:tomer_engel
Comment Utility
if StrToInt(edit2.Text) >= StrToInt(edit1.Text)  then
  edit1.Text :=''
else edit3.text := IntToStr( StrToInt(edit1.Text) - StrToInt(edit2.Text) );

in the case your'e talking about numbers...

bye Tomer

0
 
LVL 1

Expert Comment

by:tomer_engel
Comment Utility
if StrToInt(edit2.Text) >= StrToInt(edit1.Text)  then
  edit3.Text :=''
else edit3.text := IntToStr( StrToInt(edit1.Text) - StrToInt(edit2.Text) );

in the case your'e talking about numbers...

bye Tomer

0
 
LVL 1

Expert Comment

by:tomer_engel
Comment Utility
the second one is currect not the first one!!!!
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Accepted Solution

by:
tomer_engel earned 50 total points
Comment Utility
i don't know why but in the then cluase it didn't put the double '('   ' )and switched it with "

so pay attention::::



if StrToInt(edit2.Text) >= StrToInt(edit1.Text)  then
  edit3.Text :=' '  //i mean put nothing in the edit 3 text box
else edit3.text := IntToStr( StrToInt(edit1.Text) - StrToInt(edit2.Text) );  
0
 
LVL 4

Author Comment

by:NickRackham
Comment Utility
Tomer, Sorry I'd gone to catch up my beauty sleep :o) <grin> I'll try this later and post back later.

Thanks

Nick
0
 
LVL 4

Author Comment

by:NickRackham
Comment Utility
Tomer, Many thanks - Just what I wanted. Nick
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

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

9 Experts available now in Live!

Get 1:1 Help Now