user19127 user19127 - 4 years ago 218
Vb.net Question

Format integer as string with 2 digits

I would like to format the integer 9 to "09" and 25 to "25".

Can somebody tell me how this can be done?

Thank you!

Answer Source

I don't know the exact syntax. But in any language, it would look like this.

a = 9
aString =""

if a < 10 then 
  aString="0" + a 
else 
  aString = "" + a
end if
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download