Solved

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

Posted on 2006-07-17
2
259 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now