Possible Duplicate:
C# convert int to string with padding zeros?
I am trying to generate a random number however in the ranges I have included “0000000, 9999999” I want it to show these zeros when a number is generated for example the following outputs would be:
“00037544”
“01659369”
“75484957”
“00000001”
I am using the:
int num = rnd.Next(0000000, 9999999);
The problem with that is sometimes it will generate:
“1648”
“947596”
“18500” etc
Is there something that im missing?
Thanks for looking
You have to convert it to the string and then use
PadLeft.Or Simply