I need to make a 40 digit counter variable. It should begin as 0000000000000000000000000000000000000001
and increment to
000000000000000000000000000
Just convert your string to int, perform the addition or any other operations, then convert back to string with adequate number of leading 0's:
// 39 zero's + "1"
string initValue = new String('0', 39) + "1";
// convert to int and add 1
int newValue = Int32.Parse(initValue) + 1;
// convert back to string with leading zero's
string newValueString = newValue.ToString().PadLeft(40, '0');