String.Format????

  • Thread starter Thread starter Hai Nguyen
  • Start date Start date
H

Hai Nguyen

Hi everyone I have a textbox which acts like a counter. I want to format the
number in 4 digits; for instance,
1 -> 0001
10 -> 0010

Is there anyway I can do that?

Thanks
 
Use PadLeft
if your textbox is named Textbox1:

Textbox1.Text.PadLeft
____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio
Hi everyone I have a textbox which acts like a counter. I want to format the
number in 4 digits; for instance,
1 -> 0001
10 -> 0010

Is there anyway I can do that?

Thanks
 
String.Format("{0:0000}", strMyString);

As always, at least 3 ways to do anything in MS code.

MIke
 
Back
Top