Posted on: 7/24/2013 7:53:01 PM | Views : 249

I am using Visual Studio 2010 C# language...
I have Textbox control for data input...two of the textboxes accept number (e.g 1, 2...)
I want to convert the values to integer...
Below is my code:
string tn = txttotalnoned.Text.Trim(); string tp = txttotalnopos.Text.Trim(); int totalnoneed; int totalnopost; totalnoneed = Convert.ToInt32(tn); totalnopost = Convert.ToInt32(tp); I got an error like this:
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 293: totalnoneed = Convert.ToInt32(tn); Line 294: totalnopost = Convert.ToInt32(tp); ...

Go to the complete details ...