Input string was not in correct format
<pre><code>static void Main(string[] args)
{
    //read in the file
    StreamReader convert = new StreamReader("../../convert.txt");

    //define variables
    string line = convert.ReadLine();
    int conversion;
    int numberIn;
    float conversionFactor;

    Console.WriteLine("Enter the conversion in the form (amount,from,to)");
    String inputMeasurement = Console.ReadLine();
    string[] inputMeasurementArray = inputMeasurement.Split(',');

    while (line != null)
    {
        string[] fileMeasurementArray = line.Split(',');
        if (fileMeasurementArray[0] == inputMeasurementArray[1])
        {
            if (fileMeasurementArray[1] == inputMeasurementArray[2])
            {
                Console.WriteLine("{0}", fileMeasurementArray[2]);
            }
        }

        line = convert.ReadLine();

        //convert to int
        numberIn = Convert.ToInt32(inputMeasurementArray[0]);
        conversionFactor = Convert.ToInt32(fileMeasurementArray[2]);

        conversion = (numberIn * conversionFactor);
    }

    Console.ReadKey();
}
</code></pre>

<p>On the line <code>conversionFactor = Convert.ToInt32(fileMeasurementArray[2]);</code>, I am getting an error saying "Input string was not in correct format". Please help!</p>

<p>The text file consists of the following:</p>

<pre><code>ounce,gram,28.0
pound,ounce,16.0
pound,kilogram,0.454
pint,litre,0.568
inch,centimetre,2.5
mile,inch,63360.0
</code></pre>
