locked
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll (Error) RRS feed

  • Question

  • Hello, 

    When i am trying to put negative input, it gives "An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll (Error)" and i have to use negative input in my program... What is the problem ? 

                a22 = Convert.ToDouble(textBox51.Text);

    The convert is like that?        

    Wednesday, January 27, 2016 8:51 PM

Answers

  • Can you show an example of the text that is in your textbox?  The following worked for me

    double x = Convert.ToDouble("-15.5");
    If I were to take a guess, you have a culture issue (for example Convert is expecting a comma instead of a period depending on the current thread culture).   You could try calling the version that takes an IFormatProvider to help resolve that problem.

    Wednesday, January 27, 2016 9:01 PM