Solved

Help! detect if label1.caption is less than label2.caption

Posted on 2003-11-30
2
619 Views
Last Modified: 2010-04-05
Ok heres wha i've got:

1 form
1 timer
label1
label2

On create timer 1 containing the following code adds '1' to label1.caption at a 3000 interval

If label1.caption < label2.Caption then label1.caption :=IntToStr(StrToInt(label1.caption+1);

(automatically another timer counts the number of messages on a mail server and the count is put in caption2)

This code is to stop the number in label1 exceeding label2. and if this happens there is a seperate piece of code which makes the whole process start over again.

It all works fine when

label1.caption = Between 1-9
label2.caption Between 1-9

But as soon as Label2 = more than 9 (i.e 10) it goes wrong because it is almost like timer 1 reads label2 as being 1 and not 10 and so starts back at 1 again because by now label1 will = 2/3/4//5 etc...

Using the above code how do i get timer 1 to only add '1' to label1 if this will not exceed label2 - and to get timer 1 to recognize that if label2 = 10 it it is 10 and not 1?????? therefore meaning that label2 is more than label1 so procced adding 1 to label1.

Hope this all maks sense!!!!


If you are able to help please provide full source code (its far better to spell it out than waste time going backwards and forwards)

Cheers

Harry.
0
Comment
Question by:harry_bela
[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
2 Comments
 
LVL 5

Accepted Solution

by:
Darth_helge earned 300 total points
ID: 9844907
when you do this comparison you don't compare two numbers, you compare two strings.

If label1.caption < label2.Caption then label1.caption :=IntToStr(StrToInt(label1.caption+1);

so if you convert the two labelcaptions to numbers before you compare them it should work

If StrToInt(label1.caption) < StrToInt(label2.Caption) then label1.caption :=IntToStr(StrToInt(label1.caption+1);

hope this helps

helgesen
0
 

Author Comment

by:harry_bela
ID: 9845120
Hi helgesen,

I have taken your code an have improved it so thanks....

300 points coming your way.

Harry
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month5 days, 7 hours left to enroll

627 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