I have an integer that must remain 8 digits 00000001, it must remain 8 digits after incrementing it. I had it declared as an integer but it wasnt recognising the leading zeros so I have changed it to a string however I need to increment the digit which i cant do when it is a string. Any suggestions?
coder91
0
Junior Poster
Recommended Answers
Jump to Postdefinately keep it as an integer. to add pritaeas suggestion, you can display it as a string by adding the leading zeros..
int num = 1; Label1.Text = String.Format("{0:00000000}", num);
All 4 Replies
Heanre
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
JorgeM
958
Problem Solver
Team Colleague
Featured Poster
coder91
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.