|
-
Dec 26th, 2011, 11:30 AM
#1
Thread Starter
Frenzied Member
Best Way to Handle Numbers
Hello
Only now, I'm facing this kind of problem, i have a application that until now worked with two different cultures ENG and PT, i always knew this, and i manage to solve all problems related to parsing the numbers, but now i have to change the code, and "protect" the code to handle with others cultures.
So i need tips/best way to handle different cultures, and different database culture settings.
I think that i shouldn't limit the user, by setting the decimal, the grouping digit, the date time format, etc. . The application should accept the numbers in the user current culture. But this path forces me to putting everywhere the parse/tryparse method...
This is the way that i must follow?
Thanks
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Dec 26th, 2011, 07:12 PM
#2
Re: Best Way to Handle Numbers
It may be. If you're accepting strings, after all, you need to retrieve their values some way or another, and so TryParse and Parse are ideal. In fact, it would be much easier than a manual conversion...
If you have type-restricted fields with matching UI elements, consider using type-specific controls like NumericUpDown and DateTimePicker, which automatically adapt based on the culture.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|