It's working fine but the error is 'Input string was not in a correct format.' - C#