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
 
Hai Nguyen said:
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?

Yes - use:

String.Format ("{0:d4}", myInt)
 
Back
Top