Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-07-17
2
Medium Priority
?
271 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
[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 43

Accepted Solution

by:
TimCottee earned 100 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 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