Solved

# Syntax problem with if statement

Posted on 2000-04-21
199 Views
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
Question by:NickRackham
[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
• 4
• 2

LVL 1

Expert Comment

ID: 2738980
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

ID: 2738982
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

ID: 2738983
the second one is currect not the first one!!!!
0

LVL 1

Accepted Solution

tomer_engel earned 50 total points
ID: 2738985
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

ID: 2739636
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

ID: 2740645
Tomer, Many thanks - Just what I wanted. Nick
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

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â€¦
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â€¦
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient â€¦
Starting up a Project
###### Suggested Courses
Course of the Month8 days, 22 hours left to enroll