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?
ThanksTry
foo.ToString("0000").
Cheers,
B
"Hai Nguyen" <haiaggie@.neo.tamu.edu> wrote in message
news:O9rP95e5DHA.1936@.TK2MSFTNGP12.phx.gbl...
> 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
"Hai Nguyen" <haiaggie@.neo.tamu.edu> wrote in message news:O9rP95e5DHA.1936@.TK2MSFTNGP12.phx.gbl...
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
"Hai Nguyen" <haiaggie@.neo.tamu.edu> wrote in message
news:O9rP95e5DHA.1936@.TK2MSFTNGP12.phx.gbl...
> 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
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment