AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Input string was not in a correct format.
Posted by songuku on  11/27/2010 11:32:10 PM Category: ADO.NET
Add to my favorites
Email to friend
Can you help me ????????

Line 76: ddlMonth.Items.Add(Convert.ToString(i));
Line 77: }
Line 78: for (int i = 1945; i <= Convert.ToInt32(GetYear()); i++)
Line 79: {
Line 80: ddlYear.Items.Add(Convert.ToString(i));


Source File: d:\Post Office\Sourecode\OPMS\Admin\AddNewEmployee.aspx.cs Line: 78

Stack Trace:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7467367
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
System.Convert.ToInt32(String value) +63
Admin_AddNewEmployee.loadDateTime() in d:\Post Office\Sourecode\OPMS\Admin\AddNewEmployee.aspx.cs:78
Admin_AddNewEmployee.Page_Load(Object sender, EventArgs e) in d:\Post Office\Sourecode\OPMS\Admin\AddNewEmployee.aspx.cs:43
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Post Your Reply Post New Question

 Viewer's Reply
Input String was Not in Correct Format in Asp.Net
Answered By Moderator1 on 11/30/2010 6:28:29 AM
You need to make sure GetYear() returns only Year.. I think it returns other than Integer..so it cause error.
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Windows 8: 50 Questions and Answers You Need to Make a Decision (Normally $9.95)
Backup and Recovery Best Practices for Microsoft SQL Server 2005
Many .NET teams are underperforming, is yours?