The problem is you’re expecting integers to behave like strings.
The point you’re missing is that:
int a = 01;
is the same as:
int a = 1;
There’s no difference. You can’t pad an integer. What you need is to format the integers into a string, using a format specifier. Something like this:
pictureBox1.ImageLocation =
string.Format("http://garfield.com/uploads/strips/{0:D4}-{1:D2}-{2:D2}.jpg",
year, month, day);
This will give a string that contains the numbers in the format yyyy-mm-dd.
(The documentation for padding string-formatted integers is here.)
solved Why won’t my c# application work? [closed]