I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

June Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Single User Apps Topic   Print This    All Groups  

problem with if statment

problem with if statment in Delphi Single User Apps topic (part of our Pascal and Delphi Coding group).

Quick Search: problem   statment   problem if   problem if statment  
Mido
 (Inactive)
-- USA
Hi all
I used this code

var
i:integer;
begin
for i:=1 to 10 do begin
if Edit1.Text=inttostr(i) then begin
case strtoint(Edit2.text) of
-1: Edit2.Text:='30';
-2: Edit2.Text:='60';
-3: Edit2.Text:='90';
-4: Edit2.Text:='120';
-5: Edit2.Text:='150';
-6: Edit2.Text:='180';
-7: Edit2.Text:='200';
end;
end;
end;


but what if I want edit2.text :='2.5' ??? it can't be because it is integer not float.
and I can't changer the var to variant . so what can I do ???
please help
 Posted 18 years ago (Thread Starter)
Comment Quote
About Mido -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #3010, 2 replies
Thread Started 7/17/2001 3:44:00 PM
View Counter=1221
Last Reply Posted 7/26/2001 8:44:00 PM)
Location=-- USA 
Joined=18 years ago   MB Posts=21  
Most Recent Post
William Pantoja
Woodinville, WA, USA
However, it would be easier to use FloatToStr or FloatToStrF.

---
William Pantoja

Consultant/Software Engineer
ForceOne Technologies, Inc.

 Posted 18 years ago
Comment Quote
About William Pantoja -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #3054 (Level 1.1)  Reply to 3010
Thread Started 7/26/2001 8:44:00 PM
View Counter=2
Location=Woodinville, WA, USA  
Joined=18 years ago   MB Posts=163   KB Posts=1  
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
Use the Delphi Format function:




Edit2.Text := Format('%4.2d',[2.5]);




Format returns a String, and works similar to the standard C sprintf function (but takes a variant array as the argument for the values).

Now that
 Posted 18 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #3013 (Level 1.2)  Reply to 3010
Reply Posted 7/17/2001 6:01:00 PM
Location=Las Vegas, NV USA 
Joined=17 years ago   MB Posts=442   KB Posts=19  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1183A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #3010 Counter
1221
Since 4/2/2008
Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech