Server Error in '/' Application.
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 31: int ppi = Convert.ToInt32(Text1.Text);
SOLUTION:
I tried to change int ppi = Convert.ToInt32(Text1.Text); statement to int ppi = int.Parse(Text1.Text); and int ppi = Int32.Parse(Text1.Text); and int ppi = Int16.Parse(Text1.Text); but it didn't work.
The reason was I was using a float value and parsing into an integer one, so I change the erroneous statement to the following, and it worked:
float ppi = float.Parse(Text1.Text);