Solved

Format integer with leading zero into edit

Posted on 2013-11-04
2
738 Views
Last Modified: 2013-11-04
Hi,
I'm trying to format an integer with a leading zero before copying to an edit. I have an integer value which can be between 0 and 99. I want to format it with a leading zero and put it into a memo so that a 0 through 9 would appear as 00 through 09. Here is what i have tried:
Edit17.Text := Format('',[MyInteger]);
Edit17.Text := (Format('',[2, MyInteger]));
I've tried several different combinations of this with no luck. It keeps comming back with no leading zero. What do I need to do ?
0
Comment
Question by:ChLa
[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 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 39622934
Try:

Edit17.Text := Format('%.2d', [MyInteger]);

Open in new window

0
 

Author Closing Comment

by:ChLa
ID: 39623218
That did it. Thank you.
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

Suggested Solutions

Title # Comments Views Activity
Making delphi communicate with a c# service 16 137
Dev Express grid collapse 2 52
TEMBEDDEDWB how can i change its user agent ? 8 101
firemonkey Android Listview Sort items 7 97
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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