Solved

display an int with 1 or 2 digits as a 2 digit number?

Posted on 2006-07-17
2
265 Views
Last Modified: 2010-04-23
If I have an integer with 1 or 2 digits e.g. 1 or 9 or 11 how can I display it as two digits?

i.e.
01, 09 and 11

There must be a function of something instead of inspecting the int and adding a '0' to the begining of it if it is only 1 digit long

Thanks
0
Comment
Question by:se402036se
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 25 total points
ID: 17122049
Hi se402036se,

Msgbox MyInteger.ToString("00")

It is the display that is important, a numeric cannot have formatting so you need to convert it to a string with the appropriate formatting.

Tim Cottee
0
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 17122948
You can also try MyInteger.ToString.Padleft(2, "0")
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

827 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