Click here to Skip to main content
15,884,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi experts,

we all know how to store application configuration data in app.config using the "Properties" tab of a project's properties. Today I tried to store a float there, changeable by user.

Upon entering 0.2 I am confronted with an error message saying that "0.2" cannot be converted to an instance of the "float" (in German, including the crude grammar).


How can I store values between 0 and 1 in app.config?
Posted
Updated 25-Mar-14 3:11am
v3

1 solution

The message occurred because you are using German version of Visual Studio, and you are trying to input value in English.

If you are using German version of the Windows, and your software is designed to be installed only in Germany make no sense to use numbers in English format, but if not you have two solution two solve this:

1.Use string value like "0.2" in place of "float", then in your logic converted as you want.(I recommend you to use this first solution, because is more flexible!)

2.Input in VS the value in German style like 0,2 then in the associated app.config you could change the value (as you want) in English 0.2
 
Share this answer
 
v2
Comments
lukeer 25-Mar-14 9:59am    
Not that I understand it, numbers are entered in English everywhere in the code. But yes, it works. Thank you very much.
Raul Iloc 25-Mar-14 10:03am    
I am glad that I could help you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900