none
Input string was not in a correct format, Convert String to Float

    Question

  • I want to convert a string to float, but i have this error:

    "Input string was not in a correct format, Convert String to Float"

    File content: "16.1"

    Code:

    curVersion = float.Parse(File.ReadAllText(gmFilesPath) + @"\Astro And Aliens\AstroAndAliens_Data\Managed\GAssemblyVersion.dll", System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

    Friday, April 28, 2017 1:01 PM

Answers

  • I am not sure but you are reading a dll file as text and then parsing the contents to float. 

    You do know that a dll when read as text will not give you numeric value?

    and you are not even reading the file but the path that you are specifying in the variable 

    File.ReadAllText(gmFilesPath)


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     


    Friday, April 28, 2017 1:07 PM

All replies

  • I am not sure but you are reading a dll file as text and then parsing the contents to float. 

    You do know that a dll when read as text will not give you numeric value?

    and you are not even reading the file but the path that you are specifying in the variable 

    File.ReadAllText(gmFilesPath)


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     


    Friday, April 28, 2017 1:07 PM
  • I am not sure but you are reading a dll file as text and then parsing the contents to float. 

    You do know that a dll when read as text will not give you numeric value?

    and you are not even reading the file but the path that you are specifying in the variable 

    File.ReadAllText(gmFilesPath)



    Oh , i forgot to add File.ReadAllText at the beginning, lol, thx :)) 
    Friday, April 28, 2017 1:28 PM