Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Something wrong with how I'm using Substring()?
Message
From
11/01/2007 15:48:24
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Something wrong with how I'm using Substring()?
Miscellaneous
Thread ID:
01184772
Message ID:
01184772
Views:
74
Hello.

I'm getting an error on the last line of the code below "ArgumentOutOfRangeException Make sure all arguments to this method have valid values as defined by the invoked method...."
int nYear = DateTime.Now.Year;
int nDay = DateTime.Now.Day;
int nMonth = DateTime.Now.Month;
string cKey = nMonth.ToString().PadLeft(2, '0');
cKey += nDay.ToString().PadLeft(2, '0');
cKey += nYear.ToString().Substring(3, 2);
What am I doing wrong?

TIA.
The American Republic will endure, until politicians realize they can bribe the people with their own money.
- Alexis de Tocqueville

No man’s life, liberty, or property is safe while the legislature is in session.
– Mark Twain (1866)
Next
Reply
Map
View

Click here to load this message in the networking platform