Alkis
Alkis

Reputation: 67

C# WinForms How to increase number with specific format

I want to make increment that not starts for example from 0 to 1000 but from 0000 to 1000 how i can do that?

Upvotes: 0

Views: 159

Answers (1)

Tim Schmelter
Tim Schmelter

Reputation: 460340

You want to to format a number as string:

0.ToString("D4"); // "0000"
1.ToString("D4"); // "0001"

http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx

Demo: http://ideone.com/VlYBh

Upvotes: 2

Related Questions