how add zeros to numbers...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello...
i have a number which i want to add 0's to it..

e.g.
int number = 002;
number = number + 1 and it should return me e.g. 3.
how can i keep the 002 and allow it to return 003 instead of just 3?

thanks.
 
Hi Asha,

Try this?

int number = 002;
number = number + 1;
Label1.Text=number.ToString("000");

Ken
Microsoft MVP [ASP.NET]
Toronto
 
You don't have a number. You have a string. In numbers, 002 IS 2. There are
no leading zeros. There are only bits. A 32-bit integer, for example, has 32
bits, all of which are either 1 or 0.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Back
Top